#include using namespace std; #define int long long templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b 0){ if(m & 1) ans = (ans * n) % MOD; n = (n * n) % MOD; m >>= 1; } return ans; } int ncr(int n, int r){ return kk[n-k]* kai%MOD * rkai[n-r] % MOD; } signed main(){ ios::sync_with_stdio(false); cin.tie(0); cin >> n >> k; for(int i = 0;i < n;i++){ cin >> a[i]; } int now = 1; rkai[0] = pow_mod(now, MOD-2); for(int i = 1;i <= n;i++){ now =(now*i) % MOD; rkai[i] = pow_mod(now, MOD-2); } for(int i = 1;i <= k;i++) kai = (kai*i) % MOD; kk[0] = kai; for(int i = 1;i <= n;i++){ kk[i] = kk[i-1] * (k+i) % MOD; } kai = pow_mod(kai, MOD-2); int ans = 0; for(int i = 0;i < n;i++){ int l = i; int r = n-i-1; ans += a[i] * ncr(k+l, k) % MOD * ncr(k+r, k) % MOD; ans %= MOD; } cout << ans << endl; return 0; }