#include<cstdio> usingnamespace std; template <classType> voidread(Type &x) { char c; bool flag = false; while ((c = getchar()) < '0' || c > '9') flag |= c == '-'; x = c - '0'; while ((c = getchar()) >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0'; if (flag) x = ~x + 1; } template <classType, class ...Rest> voidread(Type &x, Rest &...y){ read(x); read(y...); } template <classType> voidwrite(Type x) { if (x < 0) putchar('-'), x = ~x + 1; if (x > 9) write(x / 10); putchar('0' + x % 10); } typedeflonglong LL; constint N = 2e5 + 10, mod = 1e9 + 7; int n, m, fact[N], ifact[N]; intbinpow(int b, int k = mod - 2) { int res = 1; for (; k; k >>= 1, b = (LL)b * b % mod) if (k & 1) res = (LL)res * b % mod; return res; } voidinit() { fact[0] = 1; for (int i = 1; i < N; ++i) fact[i] = (LL)fact[i - 1] * i % mod; ifact[N - 1] = binpow(fact[N - 1]); for (int i = N - 1; i; --i) ifact[i - 1] = (LL)ifact[i] * i % mod; } intS(int a, int b) { int res = 0; for (int i = 0; i <= b; ++i) res = (res + (b - i & 1 ? -1ll : 1ll) * ifact[i] * ifact[b - i] % mod * binpow(i, a)) % mod; return res; } intmain() { init(); read(n, m); int sum = 0; for (int i = 1, a; i <= n; ++i) read(a), sum = (sum + a) % mod; write(((LL)sum * (S(n, m) + (n - 1ll) * S(n - 1, m) % mod) % mod + mod) % mod); return0; }