#include using namespace std; const int mod = 1e9 + 7; int add(int a, int b) { return (a += b) >= mod ? a - mod : a; } int mul(int a, int b) { return 1LL * a * b % mod; } void upd(int &a, int b) { if ((a += b) >= mod) { a -= mod; } } 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; int foo = 0; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; upd(foo, mod - modpow(a[i], c)); } vector dp0(180); dp0[0] = 1; // doubling for (int ii = 0; ii < 62; ii++) { vector dp1 = dp0; for (int i = 0; i < n; i++) { for (int j = 170; j >= 0; j--) { upd(dp1[j + 1], mul(dp1[j], a[i])); } } fill(dp0.begin(), dp0.end(), 0); for (int j = 0; j < 170; j++) { if ((c & 1) == (j & 1)) { dp0[j / 2] = dp1[j]; } } for (int i = 0; i < n; i++) { a[i] = mul(a[i], a[i]); } c >>= 1; } cout << add(dp0[0], foo) << endl; }