#pragma comment (linker, "/STACK:256000000")
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
const long double Ma_PI = 3.1415926535897932384626433832795028841971L;
#define eps 1e-7
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long a = 0;a < b;++a)
#define ALL(x) (x).begin(),(x).end()
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}
unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
#define int ll
void solve(){
    int n, m;
    cin >> n >> m;
    vector<pair<int,int>> inputs;
    REP(i, n) {
        int a;
        cin >> a;
        inputs.pb(mp(a / 2LL, a));
    }
    sort(ALL(inputs));
    inputs.erase(unique(inputs.begin(), inputs.end()), inputs.end());
    while (inputs.size() > 1&&inputs.back().second < 300) {
        pair<int, int> a = inputs.back();
        inputs.pop_back();
        pair<int, int> b = inputs.back();
        inputs.pop_back();
        map<int, int> gogo;
        for (int i = a.first; i < 200000; i += a.second) {
            gogo[i]++;
        }
        for (int i = b.first; i < 200000; i += b.second) {
            gogo[i]++;
        }
        int itr[2] = { -1,-1 };
        for (auto x : gogo) {
            if (x.second == 2) {
                if (itr[0] == -1) {
                    itr[0] = x.first;
                }
                else {
                    itr[1] = x.first;
                    break;
                }
            }
        }
        if (itr[0] == -1) {
            cout << 0 << endl;
            return;
        }
        inputs.push_back(mp(itr[0], itr[1] - itr[0]));
    }
    if (inputs.size() == 1) {
        if (inputs[0].first > m) {
            cout << 0 << endl;
        }
        else {
            cout << 1 + (m - inputs[0].first) / inputs[0].second << endl;
        }
        return;
    }
    int ans = 0;
    for (int i = inputs.back().first; i <= m; i += inputs.back().second) {
        int ok = 1;
        REP(q, inputs.size()) {
            if (i % inputs[q].second != inputs[q].first) {
                ok = 0;
                break;
            }
        }
        ans += ok;
    }
    cout << ans << endl;
}
#undef int
int main() {
    init();
    solve();
}

Measured memory_bytes: 6528