using namespace std;

#include<bits/stdc++.h>

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

#define getBit(x,i) (x&(1<<i))
#define setBit(x,i) (x|(1<<i))
#define mem(A,N) memset(A,N,sizeof(A))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define rep(i, x, y)  for(int i = x; i < y; ++i)
#define Rep(i, x, y)  for(int i = x; i <= y; ++i)
#define srep(i, x, y) for(int i = x; i > y; --i)
#define sRep(i, x, y) for(int i = x; i >= y; --i)
#define all(v) v.std::begin(),v.std::end()
#define Sort(x) sort(x.begin(), x.end())
#define f1(i,n) for (int i=1; i<=n; i++)
#define f0(i,n) for (int i=0; i<n; i++)
#define sz(x) ((int)(x).size())
#define len(x) ((int)(x).length())
#define fi first
#define se second
#define concatenate(a, b) std::copy(b.begin(), b.end(), std::back_inserter(a));
// #define concatenate(a, b) a.insert(b.end(), b.begin(), b.end());
// std::move(b.begin(), b.end(), std::back_inserter(a)); "Undefined behaviour if a actually is b (which is OK if you know that can never happen - but worth being aware of in general purpose code)"
#define makeUnique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define inRange(x, a, b) (a <= x && x < b)

#define linf 0x7FFFFFFFFFFFFFFF
#define inf 0x7FFFFFFF
#define mod 1000000007
#define eps 1e-9
#define Pi 3.14159265358979323846

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define write(x) cerr << #x << " = " << (x) << ", ";
#define writeI0 cerr << "i = " << 0 << ", ";
#define dumpI0 cerr << "i = " << 0 << endl;
#define printSet(s) for(auto it = s.begin(); it!=s.end(); it++) (it==s.begin())? cout << *it : cout << ' ' << *it; cout << endl;
#define printMap(m) for(auto it = m.begin(); it!=m.end(); it++) (it==m.begin())? cout << '(' << it->first << ", " << it->second << ')' : cout << " (" << it->first << ", " << it->second << ')'; cout << endl;
#define printPairSet(s) for(auto it = s.begin(); it!=s.end(); it++) (it==s.begin())? cout << '(' << it->first << ", " << it->second << ')' : cout << " (" << it->first << ", " << it->second << ')'; cout << endl;
#define printVector(x) for(auto it = x.begin(); it!=x.end(); it++) (it==x.begin())? cout << *it : cout << ' ' << *it; cout << endl;
#define printArray(a,x,y) for(auto it = a+x; it != a+y; it++) (it==a+x)? cout << *it : cout << ' ' << *it; cout << endl;
#define PrintArray(a,x,y) for(auto it = a+x; it != a+y+1; it++) (it==a+x)? cout << *it : cout << ' ' << *it; cout << endl;

// ***************** End Of Template ********************

int a[100000];
//string s;

ll gcd (ll a, ll b) {
	ll t;
	while(b) {
		t = b;
		b = a % b;
		a = t;
	}

	return a;
}

ll lcm (ll a, ll b) {
	if(a < b) {
		swap(a, b);
	}

	return a * (b / gcd(a, b));
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n, m, t1, t2;

	cin >> n >> m;

	int z = 0;
	rep(i, 0, n) cin >> a[i];
	sort(a, a+n);

	rep(i, 0, n) {
		t1 = a[i];

		for (int j = i+1; true; j++) {
			if (j == n) {
				i = j-1;
				break;
			}
			if (a[j] != t1) {
				i = j-1;
				break;
			}
		}

		a[z++] = t1;
	}
	n = z;

	bool allThatHave2HaveItMax = true;
	int someP2 = 0;
	t1 = a[0];
	while (!(t1&1)) { // a[i] >= 2
		someP2++;
		t1 >>= 1;
		if (!t1) break;
	}

	bool couldHaveSolution = true;
	rep(i, 1, n) {
		t1 = a[i];
		t2 = 0;

		while (!(t1&1)) {
			t2++;
			t1 >>= 1;
			if (!t1) break;
		}

		if (t2 != someP2) {
			couldHaveSolution = false;
			break;
		}
	}

	if (!couldHaveSolution) {
		cout << '0';
		return 0;
	}

	int mx = a[n-1];
	int m2 = 2 * m;
	ll lc = a[0];
	rep(i, 1, n) {
		lc = lcm(lc, a[i]);

		if (lc > m2) {
			cout << '0';
			return 0;
		}
	}

	int maxCoefficientOfMultipleOfLC = m2 / lc;
	int maxCoefficientOfMultipleOfMX = m2 / mx;
	int sol = min(maxCoefficientOfMultipleOfLC, maxCoefficientOfMultipleOfMX);
	if (sol % 2 == 0) sol--;
	if (sol <= 0) {
		cout << '0';
		return 0;
	}
	else {
		cout << (sol+1) / 2;
	}

	return 0;
}

Measured memory_bytes: 640