#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   const int MN = 200010;   int exp(int x, int n) {     int ret = 1;     while (n) {       if (n & 1) ret = 1LL * ret * x % mod;       x = 1LL * x * x % mod;       n >>= 1;     }     return ret;   }   int inv(int x) { return exp(x, mod - 2); }   int fact[MN], invf[MN];   int comb(int n, int k) {     if (n < k) return 0;     return 1LL * fact[n] * invf[k] % mod * invf[n - k] % mod;   }   int S(int n, int k) {     int ret = 0;     for (int i = 0; i < k; i++) {       ret += 1LL * comb(k, i) * (i % 2 ? mod - 1 : 1) % mod * exp(k - i, n) % mod;       ret %= mod;     }     ret = 1LL * ret * invf[k] % mod;     return ret;   }   int N, K;   int W[MN];   int main() {     fact[0] = 1;     for (int i = 1; i < MN; i++) {       fact[i] = 1LL * fact[i - 1] * i % mod;     }     for (int i = 0; i < MN; i++) {       invf[i] = inv(fact[i]);     }     scanf( %d %d , &N, &K);     int sum = 0;     for (int i = 0; i < N; i++) {       scanf( %d , &W[i]);       sum += W[i];       sum %= mod;     }     int ans =         1LL * ((S(N, K) + 1LL * (N - 1) * S(N - 1, K) % mod) % mod) * sum % mod;     printf( %d , ans);   }   