#include using namespace std; using ll = long long; #define rep(i, n) for (int i=0; i<(int)(n); ++(i)) #define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i)) #define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i)) #define rep3r(i, m, n) for (int i=(int)(n)-1; (i)>=(int)(m); --(i)) #define all(x) (x).begin(), (x).end() int main() { int n; ll k; cin >> n >> k; vector a(n); rep(i, n) cin >> a[i]; map kprimes; ll kval = k; for (ll i=2; i*i<=kval; ++i) if (kval%i == 0) { kprimes[i] = 0; while (kval%i == 0) { kprimes[i]++; kval /= i; } } if (kval > 1) kprimes[kval] = 1; map, ll> acnt; rep(i, n) { ll aval = a[i]; map aprimes; for (auto pi : kprimes) { aprimes[pi.first] = 0; while (aval%pi.first == 0) { aprimes[pi.first]++; aval /= pi.first; } } auto nacnt = acnt; for (auto pi : acnt) { auto nprimes = pi.first; for (auto pi2 : aprimes) nprimes[pi2.first] = min(kprimes[pi2.first], nprimes[pi2.first]+pi2.second); nacnt[nprimes] += pi.second; } nacnt[aprimes]++; swap(nacnt, acnt); } cout << acnt[kprimes] << endl; return 0; }