#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; int main(){ ll N, P, ans=0, log=0, B; cin >> N >> P; B = 1; while(B <= 1e9/P){ B *= P; log++; } vector A(N); for (int i=0; i> A[i]; B = P; for (int i=0; i mp; for (ll j=0; j