#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) const long long MOD = 1e9 + 7; long long modpow(long long x, long long p, long long mod) { long long ret = 1; while (p) { if (p & 1) ret = ret * x % mod; x = x * x % mod; p >>= 1; } return ret; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; vector a(n); REP (i, n) cin >> a[i]; vector comb(n); // comb(i) = C(k+i, k) comb[0] = 1; for (int i = 1; i < n; i++) comb[i] = comb[i-1] * (k + i) % MOD * modpow(i, MOD-2, MOD) % MOD; long long ret = 0; REP (i, n) { long long pat = comb[i] * comb[n-1-i] % MOD; ret += pat * a[i] % MOD; ret %= MOD; } cout << ret << endl; return 0; }