#include using namespace std; using ll = long long; using pint = pair; int f(int n, int p) { while(n % p == 0) n /= p; return n; } int main() { int n, m, p; cin >> n >> m >> p; vector a(n); for(auto &i : a) cin >> i; vector b = a; for(auto &i : a)i = f(i, p); int nax = *max_element(a.begin(), a.end()); int nax2 = *max_element(b.begin(), b.end()); if(m == 1) { cout << 1 << endl; return 0; } if(nax == 1) { cout << -1 << endl; return 0; } ll ret = 1; int cnt = 0; while(ret <= m) { cnt++; if(ret * nax2 > m) { cout << cnt << endl; return 0; } ret *= nax; } cout << cnt << endl; }