#include using namespace std; const int mod = 1e9 + 7; int modpow(int a, long long b) { int ret = 1; while (b > 0) { if (b & 1) { ret = 1LL * ret * a % mod; } a = 1LL * a * a % mod; b >>= 1; } return ret; } int main() { int n; long long c; cin >> n >> c; long long foo = 0; static long long a[80]; for (int i = 0; i < n; i++) { cin >> a[i]; foo += mod - modpow(a[i], c); } // doubling // ref: https://yukicoder.me/problems/no/137 static long long dp[160]; dp[0] = 1; while (c > 0) { for (int i = 0; i < n; i++) { for (int j = n * 2 - 2; j >= 0; j--) { (dp[j + 1] += dp[j] * a[i]) %= mod; } } int cc = c & 1; for (int j = 0; j < n; j++) { dp[j] = dp[j * 2 + cc]; } for (int j = n; j < n * 2; j++) { dp[j] = 0; } for (int i = 0; i < n; i++) { a[i] = a[i] * a[i] % mod; } c >>= 1; } cout << (dp[0] + foo) % mod << endl; }