/** * @FileName a.cpp * @Author kanpurin * @Created 2021.01.08 21:45:08 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n,m,p;cin >> n >> m >> p; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; if (p == 1) continue; while (a[i] % p == 0) { a[i] /= p; } } sort(a.rbegin(), a.rend()); int ans = 0; ll x = 1; if (x >= m) { cout << 0 << endl; return 0; } if (p == 1 || a[0] == 1) { cout << -1 << endl; return 0; } while(x < m) { x *= a[0]; ans++; } cout << ans << endl; return 0; }