#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long a[200020]; int main() { long long n, m, p; cin >> n >> m >> p; long long ans = 1, m1 = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (m1 < a[i]) { m1 = a[i]; } while (a[i] % p == 0) { a[i] /= p; } if (ans < a[i]) { ans = a[i]; } } m /= m1; if (m == 0) { cout << "1" << endl; } else if (ans == 1) { cout << "-1" << endl; } else { int co = 1; long long k = 1; if (m / ans <= k) { cout << co + 1 << endl; return 0; } while (m >= 1) { k *= ans; co++; if (m / ans <= k) { cout << co + 1 << endl; return 0; } } } }