func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   long long f[5020][5020], a[5020], powk[5020], ans, ans2, invn;   int n, k;   inline long long power(long long x, long long y) {     long long res = 1;     while (y) {       if (y & 1) res = res * x % mod;       x = x * x % mod;       y >>= 1;     }     return res;   }   void init() {     powk[0] = 1;     for (register int i = 1; i <= n; i++)       powk[i] = powk[i - 1] * (k - i + 1) % mod;     invn = mod - power(n, mod - 2);   }   int main() {     scanf( %d %d , &n, &k);     init();     ans = 1;     for (register int i = 1; i <= n; i++)       scanf( %lld , &a[i]), ans = ans * a[i] % mod;     f[0][0] = 1;     for (register int i = 1; i <= n; i++) {       f[i][0] = 1;       for (register int j = 1; j <= i; j++) {         f[i][j] = (f[i - 1][j] + f[i - 1][j - 1] * a[i]) % mod;       }     }     for (register int i = 0; i <= n; i++) {       ans2 = (ans2 + f[n][i] * power(invn, n - i) % mod * powk[n - i]) % mod;     }     cout << (ans - ans2 + mod) % mod << endl;   }   