func_code_string: #include <bits/stdc++.h>   using namespace std;   char getc() {     char c = getchar();     while ((c <  A  || c >  Z ) && (c <  a  || c >  z ) && (c <  0  || c >  9 ))       c = getchar();     return c;   }   int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); }   int read() {     int x = 0, f = 1;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 )       x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();     return x * f;   }   int n, k, a[5010], f[5010][5010], ans;   int ksm(int a, int k) {     int s = 1;     for (; k; k >>= 1, a = 1ll * a * a % 1000000007)       if (k & 1) s = 1ll * s * a % 1000000007;     return s;   }   int inv(int a) { return ksm(a, 1000000007 - 2); }   void inc(int &x, int y) {     x += y;     if (x >= 1000000007) x -= 1000000007;   }   signed main() {     const char LL[] =  %lld n ;     n = read(), k = read();     for (int i = 1; i <= n; i++) a[i] = read();     f[0][0] = 1;     for (int i = 1; i <= n; i++) {       f[i][0] = 1ll * f[i - 1][0] * a[i] % 1000000007;       for (int j = 1; j <= i; j++)         f[i][j] = (1ll * f[i - 1][j] * a[i] - f[i - 1][j - 1] + 1000000007) %                   1000000007;     }     int s = 1;     for (int i = 0; i <= min(k, n); i++) {       inc(ans, 1ll * ksm(n, k - i) * f[n][i] % 1000000007 * s % 1000000007);       s = 1ll * s * (k - i) % 1000000007;     }     ans = 1ll * ans * inv(ksm(n, k)) % 1000000007;     ans = (f[n][0] - ans + 1000000007) % 1000000007;     cout << ans;     return 0;   }   