#include #define rep(i, a, n) for(int i = a; i < n; i++) using namespace std; using ll = long long; using P = pair; set prime_factor(ll n){ set pf; //if(n == 1) pf.push_back(P(1, 1)); for(ll i = 2; i*i <= n; i++){ if(n%i == 0){ while(n%i == 0){ n /= i; } pf.insert(i); } } if(n != 1) pf.insert(n); return pf; } int main() { ll n, m, p; cin >> n >> m >> p; vector a(n); rep(i, 0, n) cin >> a[i]; sort(a.begin(), a.end()); int cnt = 0; ll mx = 0; rep(i, 0, n){ set pf = prime_factor(a[i]); if(pf.find(p) != pf.end()) continue; mx = max(mx, a[i]); } if(mx == 0){ cout << -1 << endl; return 0; } ll x = 1; while(x <= m){ cnt++; if(x*a[n-1] > m) break; else x *= mx; } cout << cnt << endl; return 0; }