//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define all(x) std::begin(x), std::end(x)
#define isz(x) (int)std::size(x)
const auto io_sync_off = [](){std::ios_base::sync_with_stdio(0);std::cin.tie(0);return 0;}();
// Debug defines:
#define watch(x) std::cerr << std::setw(12) << #x << " = " << std::setw(12) << x
#define watchln(x) watch(x) << std::endl
#define watchsp(x) watch(x) << " "
#define cerr cerr && debug && std::cerr
namespace std {
    // Containers:
    template<typename T> auto size(T c) { return c.size(); }
    /*
    template<typename T> auto begin(T c) { return c.begin(); }
    template<typename T> auto end(T c) { return c.end(); }
    */
    // 2D arrays:
    template<typename T, int N, int M> auto size(const T (&)[N][M]) { return N * M; }
    template<typename T, int N, int M> auto begin(T (&a)[N][M]) { return &a[0][0]; }
    template<typename T, int N, int M> auto end(T (&a)[N][M]) { return &a[0][0] + N * M; }
    // 3D arrays:
    template<typename T, int N, int M, int K> auto size(const T (&)[N][M][K]) { return N * M * K; }
    template<typename T, int N, int M, int K> auto begin(T (&a)[N][M][K]) { return &a[0][0][0]; }
    template<typename T, int N, int M, int K> auto end(T (&a)[N][M][K]) { return &a[0][0][0] + N * M * K; }
    // Algorithms:
    template<typename C> void reuniq(C& c) { c.erase(unique(all(c)), end(c)); }
    template<typename C, typename X> int lowpos(const C& c, X x) {
        return int(lower_bound(all(c), x) - begin(c));
    }
    template<typename X, typename Y> X& remin(X& x, const Y& y) { return x = (y < x) ? y : x; }
    template<typename X, typename Y> X& remax(X& x, const Y& y) { return x = (x < y) ? y : x; }
}
// Comparators:
template<typename A, typename B> bool operator >(const A& a, const B& b) { return b < a; }
template<typename A, typename B> bool operator<=(const A& a, const B& b) { return !(a > b); }
template<typename A, typename B> bool operator>=(const A& a, const B& b) { return !(a < b); }
template<typename A, typename B> bool operator!=(const A& a, const B& b) { return a < b || b < a; }
template<typename A, typename B> bool operator==(const A& a, const B& b) { return !(a != b); }
// Input:
template<typename T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (auto &it : vec) is >> it;
    return is;
}
// Output:
template<typename A, typename B> std::ostream& operator<<(std::ostream& os, const std::pair<A,B>& pt) {
    return os << "{" << pt.first << ", " << pt.second << "}";
}
template<typename Iterator>
std::ostream& print_range(std::ostream& os, Iterator begin, Iterator end) {
    os << "{";
    for (auto it = begin; it != end; it++) {
        if (it != begin) { os << ", "; }
        os << *it;
    }
    return os << "}";
}
template<typename T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
    return print_range(os, vec.begin(), vec.end());
}
template<typename T> std::ostream& operator<<(std::ostream& os, const std::set<T>& set) {
    return print_range(os, set.begin(), set.end());
}
// Defines:
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = std::vector<int>;
using vl = std::vector<ll>;
using vvi = std::vector<vi>;
using vvl = std::vector<vl>;
using pii = std::pair<int,int>;
using pil = std::pair<int,ll>;
using pli = std::pair<ll,int>;
using pll = std::pair<ll,ll>;
// Variables:
const int debug = 0;
// -----------------------------------------------------------------------------
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }
int main() {
    // solution
    for (int n, m; std::cin >> n >> m; ) {
        vl a(n); std::cin >> a;
        for (auto &it : a) it /= 2;
        std::sort(all(a));
        std::reuniq(a);
        n = isz(a);
        int nOdd = 0, nEven = 0;
        for (auto it : a) {
            nOdd += (it % 2 == 1);
            nEven += (it % 2 == 0);
        }
        if (nEven > 0 && nOdd > 0) {
            std::cout << 0 << std::endl;
            continue;
        }
        ll lcm = a.front();
        bool ok = true;
        for (int i = 1; i < n; i++) {
            lcm = ::lcm(lcm, a[i]);
            if (lcm > m) { ok = false; break; }
        }
        if (!ok) { std::cout << 0 << std::endl; continue; }
        for (auto it : a) {
            if (lcm / it % 2 != 1) {
                ok = false;
                break;
            }
        }
        if (!ok) { std::cout << 0 << std::endl; continue; }
        // (1 + 2 * p) * lcm <= m
        ll low = 0, high = m / lcm + 1;
        while (high - low > 1) {
            ll mid = (low + high) / 2;
            if ((1 + 2 * mid) * lcm <= m) {
                low = mid;
            } else { high = mid; };
        }
        std::cout << low + 1 << std::endl;
    }
    return 0;
}

Measured memory_bytes: 1792