N, K = map(int, input().split()) MOD = 10**9 + 7 A = list(map(int, input().split())) S = [0] for a in A: S.append((S[-1] + a) % MOD) B = [0] * (N+1) B[1] = 1 b1 = b2 = 1 for i in range(2, N+1): b1 *= K+i-1 b1 %= MOD b2 *= i-1 b2 %= MOD B[i] = b1 * pow(b2, MOD-2, MOD) % MOD C = [(B[i]-B[i-1])%MOD for i in range(N+1)] SC = [0] for c in C[1:]: SC.append((SC[-1] + c) % MOD) SpC = [0] * (N+1) for i in range(1, N+1): SpC[i] = S[i] * C[N-i+1] % MOD SSpC = [0] * (N+1) SSpC[N] = SpC[N] for i in range(N-1, 0, -1): SSpC[i] = (SpC[i] + SSpC[i+1]) % MOD ans = 0 for i in range(1, N+1): ans += C[i] * SSpC[i] % MOD ans -= S[i-1] * C[i] * SC[N-i+1] % MOD ans %= MOD print(ans)