#include #include #include #include #include #include #include using namespace std; using ll = long long; constexpr int P = 1000000007; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector x(n), y(n); x[1] = 1; y[0] = 1; y[1] = k + 1; for (int i = 2; i < n; i++) { y[i] = (ll)y[i - 1] * (x[i] = P - (P / i * (ll)x[P % i] % P)) % P * (k + i) % P; } ll r = 0; for (int i = 0; i < n; i++) { int a; cin >> a; r += (ll)a * y[i] % P * y[n - 1 - i] % P; } r %= P; cout << r << endl; return 0; }