#pragma GCC optimize("Ofast") #include using namespace std; typedef long long int ll; typedef unsigned long long int ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } inline double time() { return static_cast(chrono::duration_cast(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9; } template struct static_modint { using mint = static_modint; int x; static_modint() : x(0) {} static_modint(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {} mint& operator+=(const mint& rhs) { if ((x += rhs.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint& rhs) { if ((x += mod - rhs.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint& rhs) { x = (int) (1LL * x * rhs.x % mod); return *this; } mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); } mint pow(long long n) const { mint _x = *this, r = 1; while (n) { if (n & 1) r *= _x; _x *= _x; n >>= 1; } return r; } mint inv() const { return pow(mod - 2); } mint operator+() const { return *this; } mint operator-() const { return mint() - *this; } friend mint operator+(const mint& lhs, const mint& rhs) { return mint(lhs) += rhs; } friend mint operator-(const mint& lhs, const mint& rhs) { return mint(lhs) -= rhs; } friend mint operator*(const mint& lhs, const mint& rhs) { return mint(lhs) *= rhs; } friend mint operator/(const mint& lhs, const mint& rhs) { return mint(lhs) /= rhs; } friend bool operator==(const mint& lhs, const mint& rhs) { return lhs.x == rhs.x; } friend bool operator!=(const mint& lhs, const mint& rhs) { return lhs.x != rhs.x; } friend ostream &operator<<(ostream &os, const mint &p) { return os << p.x; } friend istream &operator>>(istream &is, mint &a) { int64_t t; is >> t; a = static_modint(t); return (is); } }; const unsigned int mod = 998244353; using modint = static_modint; modint mod_pow(ll n, ll x) { return modint(n).pow(x); } modint mod_pow(modint n, ll x) { return n.pow(x); } // verify:https://www.acmicpc.net/problem/4149 namespace factorize{ using u64 = uint64_t; using u128 = __uint128_t; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); u64 binary_gcd(u64 a, u64 b) { if (a == 0) return b; if (b == 0) return a; const int n = __builtin_ctzll(a | b); a >>= __builtin_ctzll(a); while (b > 0) { b >>= __builtin_ctzll(b); if (a > b) std::swap(a, b); b -= a; } return a << n; } u128 pow (u128 a, u64 n, u128 mod) { u128 res = 1; if (a >= mod) a %= mod; while (n > 0) { if (n & 1) { res *= a; if (res >= mod) res %= mod; } a *= a; if (a >= mod) a %= mod; n >>= 1; } return res; } bool miller_rabin (u64 n, vector v) { u64 d = n-1; while (~d & 1) d >>= 1; for (u64 a:v) { if (n <= a) break; u64 t = d; u128 y = pow(a, t, n); while (t != n-1 and y != 1 and y != n-1) { y *= y; if(y >= n) y %= n; t *= 2; } if (y != n-1 and t % 2 == 0) return false; } return true; } bool is_prime (u64 n) { if (n <= 1) return false; if (~n & 1) return (n == 2); if (n < (1LL << 30)) { return miller_rabin(n, {2, 7, 61}); } else { return miller_rabin(n, {2, 325, 9375, 28178, 450775, 9780504, 1795265022}); } } template T pollard_rho (T n) { if (~n & 1) return 2; if (is_prime(n)) return n; static u128 x,y,c,d; auto f = [&](u128 x) {return (x * x % n + c) % n;}; auto rnd_ = [&](T l, T r) {return rng() % (r - l + 1) + l;}; x = rnd_(2, n); y = x; c = rnd_(1, n); d = 1; while (d == 1) { x = f(x); y = f(y); y = f(y); d = binary_gcd((x > y ? x-y : y-x), n); if ((T)d == n) { return pollard_rho(n); } } if (is_prime(d)) { return d; } else { return pollard_rho(d); } } template vector prime_factor (T n) { vector res; for (T i = 2; i*i <= n;) { while (n % i == 0) { n /= i; res.emplace_back(i); } i += 1 + (~n & 1); if (i >= 101 and n >= (1<<20)) { while (n > 1) { auto p = pollard_rho(n); while (n % p == 0) { n /= p; res.emplace_back(p); } } break; } } if (n > 1) res.emplace_back(n); sort(res.begin(), res.end()); return res; } template map factor_count (T n) { map mp; for (auto &x : prime_factor(n)) mp[x]++; return mp; } template vector divisors(T n) { if (n == 0) return {}; vector> v; for(auto &p : factor_count(n)) v.push_back(p); vector res; auto f = [&](auto self, int i, T x) -> void { if (i == (int)v.size()) { res.push_back(x); return; } for (int j = 0; j <= v[i].second; ++j) { self(self, i + 1, x); if (j+1 <= v[i].second) { x *= v[i].first; } } }; f(f, 0, 1); sort(res.begin(), res.end()); return res; } } // namespace factorize int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; ll k; cin >> k; vector a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; a[i] = gcd(a[i], k); } auto f = factorize::factor_count(k); map mp; for (auto &p : f) { ll d = p.first; int mx = 0; for (int i = 0; i < n; ++i) { int cnt = 0; while (a[i]%d == 0) { cnt += 1; a[i] /= d; } mx = max(mx, cnt); } if (mx < p.second) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; }