#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; 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; i primeFactors(long long N, const vector &primes) { // check for N if (N < 1) throw invalid_argument("invalid N for zero or minus"); map m; 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) { for (int prime : primes) { if (N % prime == 0) { m[prime] += 1; N /= prime; break; } if (prime > N) { ok = true; break; } } break; } return m; } 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 << "NO" << endl; return 0; } } auto P = primes(H+1); auto base_factors = primeFactors(A[1], P); REP(i, 2, N+1) { const auto 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; } } const auto H_factors = primeFactors(H, 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; return 0; } } cout << "YES" << endl; return 0; }