#include using namespace std; typedef long long int ll; typedef pair pll; #define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i)) #define REP(i, n) FOR(i,n,0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll) 1e15; ll A[200005]; struct Combination { Combination(ll n) { mNumTbl.resize(n + 1); mInverseNumTbl.resize(n + 1); mNumTbl[0] = 1; mInverseNumTbl[0] = 1; FOR(i, n + 1, 1) { mNumTbl[i] = (mNumTbl[i - 1] * i) % MOD; } FOR(i, n + 1, 1) { mInverseNumTbl[i] = modpow(mNumTbl[i]); } } ll get(ll n, ll r) { if (n < r || n < 0) return 0; return (((mNumTbl[n] * mInverseNumTbl[r]) % MOD) * mInverseNumTbl[n - r]) % MOD; } ll modpow(ll n) { ll s = 1, p = n; for (ll i = 0; (1LL << i) <= MOD - 2; ++i, p = (p * p) % MOD) { if (((MOD - 2) & (1 << i)) == 0) continue; s *= p; s %= MOD; } return s; } vector mInverseNumTbl; vector mNumTbl; }; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, K; cin >> N >> K; Combination cmb(100300000); REP(i, N) { cin >> A[i]; } ll ans = 0; REP(i, N) { ll l = i + 1; ll r = N - i; ll c = cmb.get(l + K - 1, K) * cmb.get(r + K - 1, K) % MOD; ans += (A[i] * c) % MOD; ans %= MOD; } cout << ans << endl; return 0; }