func_code_string: #include <bits/stdc++.h>   using namespace std;   void getint(int &v) {     char ch, fu = 0;     for (ch =  * ; (ch <  0  || ch >  9 ) && ch !=  - ; ch = getchar())       ;     if (ch ==  - ) fu = 1, ch = getchar();     for (v = 0; ch >=  0  && ch <=  9 ; ch = getchar()) v = v * 10 + ch -  0 ;     if (fu) v = -v;   }   const int MO = 1e9 + 7;   long long P[5555], ans, p[5555], T;   int n, k, a[5555], f[5010][5010];   long long pw(long long x, long long y) {     long long t = 1;     for (; y; y >>= 1) {       if (y & 1) t = t * x % MO;       x = x * x % MO;     }     return t;   }   int main() {     cin >> n >> k;     T = 1;     for (int i = 1; i <= n; ++i) getint(a[i]), T = T * a[i] % MO;     P[0] = 1;     for (int i = 1; i <= n; ++i) P[i] = P[i - 1] * (k - i + 1) % MO;     f[0][0] = 1;     for (int i = 1; i <= n; ++i) {       f[i][0] = 1;       for (int j = 1; j <= i; ++j)         f[i][j] = (f[i - 1][j] + (long long)f[i - 1][j - 1] * a[i]) % MO;     }     long long t = MO - pw(n, MO - 2);     p[0] = 1;     for (int i = 1; i <= n; ++i) p[i] = p[i - 1] * t % MO;     for (int i = 0; i <= n; ++i) {       if (n - i > k) continue;       long long x = f[n][i] * P[n - i] % MO * p[n - i] % MO;       (ans += x) %= MO;     }     cout << (T - ans + MO) % MO << endl;     return 0;   }   