using System; using System.Linq; using System.Collections.Generic; class Solution { static void Main(string[] args) { var input = Console.ReadLine().Split().Select(int.Parse).ToArray(); int N = input[0]; int K = input[1]; var A = Console.ReadLine().Split().Select(long.Parse).ToArray(); var nCk = new ModInt[N];//nCk[i]=K-1+i_C_K nCk[0] = 1; for (var i = 1; i < N; i++) nCk[i] = nCk[i - 1] * (K + i) / i; ModInt ans = 0; for (var i = 0; i < N; i++) ans += nCk[i] * nCk[N - 1 - i] * A[i]; Console.WriteLine(ans.value); } } struct ModInt { public long value; private const int MOD = 1000000007; //private const int MOD = 998244353; public ModInt(long value) { this.value = value; } public static implicit operator ModInt(long a) { var ret = a % MOD; return new ModInt(ret < 0 ? (ret + MOD) : ret); } public static ModInt operator +(ModInt a, ModInt b) => (a.value + b.value); public static ModInt operator -(ModInt a, ModInt b) => (a.value - b.value); public static ModInt operator *(ModInt a, ModInt b) => (a.value * b.value); public static ModInt operator /(ModInt a, ModInt b) => a * Modpow(b, MOD - 2); public static ModInt operator <<(ModInt a, int n) => (a.value << n); public static ModInt operator >>(ModInt a, int n) => (a.value >> n); public static ModInt operator ++(ModInt a) => a.value + 1; public static ModInt operator --(ModInt a) => a.value - 1; public static ModInt Modpow(ModInt a, long n) { var k = a; ModInt ret = 1; while (n > 0) { if ((n & 1) != 0) ret *= k; k *= k; n >>= 1; } return ret; } private static readonly List Factorials = new List() { 1 }; public static ModInt Fac(long n) { for (var i = Factorials.Count(); i <= n; i++) { Factorials.Add((Factorials[i - 1] * i) % MOD); } return Factorials[(int)n]; } public static ModInt nCr(long n, long r) { return n < r ? 0 : Fac(n) / (Fac(r) * Fac(n - r)); } public static explicit operator int(ModInt a) => (int)a.value; }