#include using namespace std; using LL = long long; using ULL = unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) template struct MLL { ULL x; MLL(ULL val = 0) : x(val) {} MLL& operator+=(MLL r) { x += r.x; if (x >= M) x -= M; return *this; } MLL operator+(MLL r) const { MLL res = x; return res += r; } MLL& operator-=(MLL r) { x += M - r.x; if (x >= M) x -= M; return *this; } MLL operator-(MLL r) const { MLL res = x; return res -= r; } MLL& operator*=(MLL r) { x = x * r.x % M; return *this; } MLL operator*(MLL r) const { return MLL(x * r.x % M); } MLL operator^(ULL r) const { if (r == 0) return MLL(1); MLL res = (*this * *this) ^ (r / 2); if (r % 2) res *= *this; return res; } MLL& operator^=(ULL r) { return *this = *this ^ r; } MLL& operator/=(MLL r) { *this *= r ^ (M - 1); return *this; } MLL operator/(MLL r) const { return *this * (r ^ (M - 2)); } ULL& operator*() { return x; } const ULL& operator*() const { return x; } }; using MLL1 = MLL<1000000007>; MLL1 F[110000001]; MLL1 C(int n, int r) { return F[n] / F[r] / F[n - r]; } int N; int K; ULL A[200000]; int main() { cin >> N >> K; F[0] = 1; rep(i, 110000000) F[i + 1] = F[i] * (i + 1); MLL1 ans = 0; rep(i, N) { MLL1 a; cin >> *a; ans += a * C(K + i, K) * C(K + N - 1 - i, K); } cout << *ans << endl; return 0; }