#include using namespace std; #include typedef boost::multiprecision::cpp_int mp; int main(){ int N,K; cin>>N>>K; vector A(N); int s=0; for(int i=0;i>A[i]; s+=A[i]; } int ans=0; int temp=1; for(int i=N-1;i>=0;i--){ ans=(ans+temp*A[i])%s; temp=(temp*K)%s; } cout<