N,K = map(int,input().split()) A = list(map(int,input().split())) P = 10 ** 9 + 7 C = N + 5 fact = [1] * C fact_inv = [1] * C factk = [1] * C factk[1] = K + 1 for i in range(2,C): fact[i] = fact[i-1] * i % P factk[i] = factk[i-1] * (K + i) % P fact_inv[-1] = pow(fact[-1],P-2,P) for i in range(C-2,0,-1): fact_inv[i] = fact_inv[i+1] * (i + 1) % P def comb(x): return factk[x-1] * fact_inv[x-1] % P ans = 0 for i in range(N): tmp = A[i] * comb(i+1) % P * comb(N-i) % P ans = (ans + tmp)% P print(ans)