#include using namespace std; using ll=long long; #include using namespace atcoder; #pragma GCC target ("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define rep(i,a,b) for(it i=(it)(a);i<=(it)b;i++) #define nrep(i,a,b) for(it i=(it)(a);i>=(it)b;i--) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define moda 998244353LL #define modb 1000000007LL #define gyaku 166374059LL #define dai 2500000000000000000LL #define sho -dai #define aoi 1e+18 #define tyu 2500000000 #define giri 1000000000 #define en 3.14159265358979 #define endl '\n' #define eps 1e-14 #define yn(x) cout<<(x?"Yes\n":"No\n"); #define YN(x) cout<<(x?"YES\n":"NO\n"); #define cou(x) cout<>x; #define fi(x) cout<; using ip=pair; using mint=modint; using mints=modint998244353; using minto=modint1000000007; using vi=vector; using ivi=vector; using vd=vector; using vs=vector; using vc=vector; using vb=vector; using vp=vector

; using ivp=vector; using vm=vector; using vms=vector; using vmo=vector; using sp=set

; using isp=set; using ss=set; using sc=set; using si=set; using isi=set; using svi=set; using vvi=vector; using ivvi=vector; using vvd=vector; using vvs=vector; using vvb=vector; using vvc=vector; using vvp=vector; using ivvp=vector; using vvm=vector; using vvms=vector; using vvmo=vector; using vsi=vector; using ivsi=vector; using vsp=vector; using ivsp=vector; using vvsi=vector; using ivvsi=vector; using vvsp=vector; using ivvsp=vector; using vvvi=vector; using ivvvi=vector; using vvvd=vector; using vvvm=vector; using vvvvi=vector; using ivvvvi=vector; const it dx[4]={0,1,0,-1}; const it dy[4]={1,0,-1,0}; template void scan(vector &a){ rep(i,0,a.size()-1)cin>>a[i]; } template void scan(vector &a,vector&b){ rep(i,0,a.size()-1)cin>>a[i]>>b[i]; } template void scan(vector> &a){ rep(i,0,a.size()-1)cin>>a[i].first>>a[i].second; } template void dec(vector &a){ rep(i,0,a.size()-1)a[i]--; } it gcda(it a,it b,it x){ //xは使わない if(!a||!b){ return max(a,b); } while(a%b&&b%a){ if(a>b)a%=b; else b%=a; } return min(a,b); } it lcma(it a,it b,it x){ //xは使わない return a/gcda(a,b,x)*b; } vvmo gyo(vvmo &a,int n){ vvmo ans(n,vmo(n)); rep(i,0,n-1) rep(j,0,n-1) rep(k,0,n-1) ans[i][j]+=a[i][k]*a[k][j]; return ans; } vvmo gyo(vvmo &a,vvmo &b,int n){ vvmo ans(n,vmo(n)); rep(i,0,n-1) rep(j,0,n-1) rep(k,0,n-1) ans[i][j]+=a[i][k]*b[k][j]; return ans; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n,k,sum=0;cin>>n>>k; ivi a(n);scan(a); for(int i:a)sum+=i; mint::set_mod(sum); mint ans=0; for(int i:a){ ans*=k; ans+=i; } cout<