#include using namespace std; using ll =long long; #define all(v) v.begin(),v.end() #define rep(i,a,b) for(int i=a;i=b;i--) ll INF=2e18; int main() { ll N,P;cin>>N>>P; vector A(N); for(ll i=0;i>A[i]; ll now=1; ll ans=0; while(now<=1000000000) { now*=P; map S; for(ll i=0;i