#include "bits/stdc++.h" using namespace std; #define rep(i, n) REP(i, 0, n) #define REP(i, k, n) for(auto i = k; i != n; i++) #define rrep(i, n) RREP(i, n, -1) #define RREP(i, n, k) for(auto i = n; i != k; i--) #define debug(x) cerr << #x << " " << x << endl #define print(x) cout << x; #define println(x) cout << x << endl; #define spc << " " << #define mp make_pair #define mt make_tuple #define pf push_front #define pb push_back #define ppf pop_front #define ppb pop_back #define eb emplace_back #define np next_permutation using ll = long long; using Pii = pair; using Tiii = tuple; templateusing V = vector; templateusing VV = vector>; using Vi = vector; using VVi = vector>; vector *primes(int size) { if (size < 0) throw invalid_argument("prime of minus"); vector *res = new vector(); if (size <= 8){ for (int pr : {2, 3, 5, 7}) { if (pr < size) res->push_back(pr); } return res; } bool *opened = new bool[size]; for (int i=0; ipush_back(i); for (int j=i; jpush_back(i); } } delete[] opened; return res; } // 素因数分解 map *primeFactors(long long N, vector *primes) { // check for N if (N < 1) throw invalid_argument("invalid N for zero or minus"); map *m = new map(); if (N == 1) { m->insert(make_pair(1, 1)); return m; } // check for primes if ((*primes)[primes->size()-1] < (int)sqrt(N)) throw invalid_argument("insufficient primes vector"); bool ok = false; while (not ok) { bool end_in_mid = false; for (int prime : *primes) { if (N % prime == 0) { (*m)[prime] += 1; N /= prime; end_in_mid = true; break; } if (prime > N) { ok = true; end_in_mid = true; break; } } if (!end_in_mid) { if (N > 1) (*m)[N] = 1; break; } } return m; } std::vector *P; std::map *base_factors, *add_factors, *H_factors; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, H; cin >> N >> H; std::vector A(N+1); REP(i, 1, N+1) cin >> A[i]; REP(i, 1, N+1) { if (A[i] < 0) A[i] *= -1; else if (A[i] == 0) { cout << "YES" << endl; return 0; } } P = primes(H+1); base_factors = primeFactors(A[1], P); REP(i, 2, N+1) { add_factors = primeFactors(A[i], P); for (auto iter = add_factors->begin(); iter != add_factors->end(); iter++) { const int key = iter->first; const int val = iter->second; (*base_factors)[key] += val; } delete add_factors; } H_factors = primeFactors(H, P); delete P; for (auto iter = H_factors->begin(); iter != H_factors->end(); iter++) { const int key = iter->first; const int val = iter->second; if ((*base_factors)[key] < val) { cout << "NO" << endl; delete base_factors; delete H_factors; return 0; } } cout << "YES" << endl; delete base_factors; delete H_factors; return 0; }