//GIVE ME AC!!!!!!!!!!!!!!!!! #include #define ll long long #define MOD 1000000007 #define rep(i,n) for(int i=0;i>n>>m>>p; vector>a(n); int one=0; rep(i,n){ int b; cin>>b; int sum=0; while(b%p==0){ b/=p; sum++; } if(b==1){ one++; } a[i]=make_pair(b,sum); } sort(a.begin(),a.end()); int ans=0; int start=1; if(one==n){ cout<<-1<