#include <bits/stdc++.h>
namespace IO {
inline char get_char() {
  static const int Rlen = 1 << 22 | 1;
  static char buf[Rlen], *p1, *p2;
  return (p1 == p2) && (p2 = (p1 = buf) + fread(buf, 1, Rlen, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
template <typename T>
inline T get() {
  char c;
  while (!isdigit(c = get_char()))
    ;
  T num = c ^ 48;
  while (isdigit(c = get_char())) num = (num + (num << 2) << 1) + (c ^ 48);
  return num;
}
inline int gi() { return get<int>(); }
}  // namespace IO
using namespace IO;
using std::cerr;
using std::cout;
const int mod = 1e9 + 7;
inline int add(int a, int b) {
  a += b - mod;
  return a + ((a >> 31) & mod);
}
inline int dec(int a, int b) {
  a -= b;
  return a + ((a >> 31) & mod);
}
inline int mul(int a, int b) {
  long long r = (long long)a * b;
  return r >= mod ? r % mod : r;
}
inline int power(int a, int b, int res = 1) {
  for (; b; b >>= 1, a = mul(a, a)) (b & 1) && (res = mul(res, a));
  return res;
}
inline void Inc(int &a, int b) {
  a += b - mod;
  a += (a >> 31) & mod;
}
inline void Dec(int &a, int b) {
  a -= b;
  a += (a >> 31) & mod;
}
inline void Mul(int &a, int b) { a = mul(a, b); }
const int N = 2e5 + 7;
int p[N], pc, mnp[N];
int fac[N], ifac[N];
inline void linear_sieves(int lim) {
  for (int register i = 2; i <= lim; ++i) {
    if (!mnp[i]) p[++pc] = i;
    for (int register j = 1; i * p[j] <= lim; ++j) {
      mnp[i * p[j]] = p[j];
      if (i % p[j] == 0) break;
    }
  }
  fac[0] = fac[1] = ifac[0] = ifac[1] = 1;
  for (int register i = 2; i <= lim; ++i) fac[i] = mul(fac[i - 1], i);
  ifac[lim] = power(fac[lim], mod - 2);
  for (int register i = lim - 1; i; --i) ifac[i] = mul(ifac[i + 1], i + 1);
}
int pw[N];
inline int S(int n, int k) {
  int ans = 0;
  for (int register i = 0; i <= k; ++i) {
    pw[i] = mnp[i] ? mul(pw[i / mnp[i]], pw[mnp[i]]) : power(i, n);
    int val = mul(ifac[k - i], mul(pw[i], ifac[i]));
    ((k - i) & 1) ? Dec(ans, val) : Inc(ans, val);
  }
  return ans;
}
signed main() {
  int n, k, sum = 0;
  n = gi(), k = gi();
  linear_sieves(n);
  for (int register i = 1; i <= n; ++i) Inc(sum, gi());
  cout << mul(sum, add(S(n, k), mul(n - 1, S(n - 1, k)))) << "\n";
  return 0;
}

### Prompt

Generate a Cpp solution to the following problem:

You are given a set of n elements indexed from 1 to n. The weight of i-th element is wi. The weight of some subset of a given set is denoted as <image>. The weight of some partition R of a given set into k subsets is <image> (recall that a partition of a given set is a set of its subsets such that every element of the given set belongs to exactly one subset in partition).

Calculate the sum of weights of all partitions of a given set into exactly k non-empty subsets, and print it modulo 109 + 7. Two partitions are considered different iff there exist two elements x and y such that they belong to the same set in one of the partitions, and to different sets in another partition.

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 2·105) — the number of elements and the number of subsets in each partition, respectively.

The second line contains n integers wi (1 ≤ wi ≤ 109)— weights of elements of the set.

Output

Print one integer — the sum of weights of all partitions of a given set into k non-empty subsets, taken modulo 109 + 7.

Examples

Input

4 2
2 3 2 3


Output

160


Input

5 2
1 2 3 4 5


Output

645

Note

Possible partitions in the first sample:

  1. {{1, 2, 3}, {4}}, W(R) = 3·(w1 + w2 + w3) + 1·w4 = 24; 
  2. {{1, 2, 4}, {3}}, W(R) = 26; 
  3. {{1, 3, 4}, {2}}, W(R) = 24; 
  4. {{1, 2}, {3, 4}}, W(R) = 2·(w1 + w2) + 2·(w3 + w4) = 20; 
  5. {{1, 3}, {2, 4}}, W(R) = 20; 
  6. {{1, 4}, {2, 3}}, W(R) = 20; 
  7. {{1}, {2, 3, 4}}, W(R) = 26; 



Possible partitions in the second sample:

  1. {{1, 2, 3, 4}, {5}}, W(R) = 45; 
  2. {{1, 2, 3, 5}, {4}}, W(R) = 48; 
  3. {{1, 2, 4, 5}, {3}}, W(R) = 51; 
  4. {{1, 3, 4, 5}, {2}}, W(R) = 54; 
  5. {{2, 3, 4, 5}, {1}}, W(R) = 57; 
  6. {{1, 2, 3}, {4, 5}}, W(R) = 36; 
  7. {{1, 2, 4}, {3, 5}}, W(R) = 37; 
  8. {{1, 2, 5}, {3, 4}}, W(R) = 38; 
  9. {{1, 3, 4}, {2, 5}}, W(R) = 38; 
  10. {{1, 3, 5}, {2, 4}}, W(R) = 39; 
  11. {{1, 4, 5}, {2, 3}}, W(R) = 40; 
  12. {{2, 3, 4}, {1, 5}}, W(R) = 39; 
  13. {{2, 3, 5}, {1, 4}}, W(R) = 40; 
  14. {{2, 4, 5}, {1, 3}}, W(R) = 41; 
  15. {{3, 4, 5}, {1, 2}}, W(R) = 42. 

### Response

```cpp
#include <bits/stdc++.h>
namespace IO {
inline char get_char() {
  static const int Rlen = 1 << 22 | 1;
  static char buf[Rlen], *p1, *p2;
  return (p1 == p2) && (p2 = (p1 = buf) + fread(buf, 1, Rlen, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
template <typename T>
inline T get() {
  char c;
  while (!isdigit(c = get_char()))
    ;
  T num = c ^ 48;
  while (isdigit(c = get_char())) num = (num + (num << 2) << 1) + (c ^ 48);
  return num;
}
inline int gi() { return get<int>(); }
}  // namespace IO
using namespace IO;
using std::cerr;
using std::cout;
const int mod = 1e9 + 7;
inline int add(int a, int b) {
  a += b - mod;
  return a + ((a >> 31) & mod);
}
inline int dec(int a, int b) {
  a -= b;
  return a + ((a >> 31) & mod);
}
inline int mul(int a, int b) {
  long long r = (long long)a * b;
  return r >= mod ? r % mod : r;
}
inline int power(int a, int b, int res = 1) {
  for (; b; b >>= 1, a = mul(a, a)) (b & 1) && (res = mul(res, a));
  return res;
}
inline void Inc(int &a, int b) {
  a += b - mod;
  a += (a >> 31) & mod;
}
inline void Dec(int &a, int b) {
  a -= b;
  a += (a >> 31) & mod;
}
inline void Mul(int &a, int b) { a = mul(a, b); }
const int N = 2e5 + 7;
int p[N], pc, mnp[N];
int fac[N], ifac[N];
inline void linear_sieves(int lim) {
  for (int register i = 2; i <= lim; ++i) {
    if (!mnp[i]) p[++pc] = i;
    for (int register j = 1; i * p[j] <= lim; ++j) {
      mnp[i * p[j]] = p[j];
      if (i % p[j] == 0) break;
    }
  }
  fac[0] = fac[1] = ifac[0] = ifac[1] = 1;
  for (int register i = 2; i <= lim; ++i) fac[i] = mul(fac[i - 1], i);
  ifac[lim] = power(fac[lim], mod - 2);
  for (int register i = lim - 1; i; --i) ifac[i] = mul(ifac[i + 1], i + 1);
}
int pw[N];
inline int S(int n, int k) {
  int ans = 0;
  for (int register i = 0; i <= k; ++i) {
    pw[i] = mnp[i] ? mul(pw[i / mnp[i]], pw[mnp[i]]) : power(i, n);
    int val = mul(ifac[k - i], mul(pw[i], ifac[i]));
    ((k - i) & 1) ? Dec(ans, val) : Inc(ans, val);
  }
  return ans;
}
signed main() {
  int n, k, sum = 0;
  n = gi(), k = gi();
  linear_sieves(n);
  for (int register i = 1; i <= n; ++i) Inc(sum, gi());
  cout << mul(sum, add(S(n, k), mul(n - 1, S(n - 1, k)))) << "\n";
  return 0;
}

```