/** * author: shu8Cream * created: 08.01.2021 21:06:40 **/ #include using namespace std; #define rep(i,n) for (int i=0; i<(n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using P = pair; using vi = vector; using vvi = vector; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n,m,p; cin >> n >> m >> p; vector

a(n); rep(i,n){ cin >> a[i].first; while(a[i].first%p==0){ a[i].first/=p; a[i].second++; } } sort(all(a)); int tmp = 1; int ans = 0; if(a[n-1].first==1){ cout << -1 << endl; return 0; } while(tmp