#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair((a),(b)) #define pb(a) push_back(a) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<<(x)<0){ if(n&1) mat_mul(tmp_pow, dst, dst); mat_mul(tmp_pow, tmp_pow, tmp_pow); n /= 2; } } // x^n mod long mod_pow(long x, long n, long mod){ long res=1; x %= mod; while(n>0){ if(n&1) res=res*x%mod; x=x*x%mod; n>>=1; } return res; } int main(){ int n; long c; cin>>n>>c; vector vec(n); rep(i,n) scanf("%ld", &vec[i]); fill(mat[0], mat[n], 0); rep(i,n) rep(j,i+1) mat[i][j]=vec[i]; mat_pow(mat, c-1, mat); long res=0; rep(i,n){ rep(j,n) res += mat[i][j]*vec[j] % MOD; res -= mod_pow(vec[i], c, MOD); } while(res<0) res+=MOD; cout << res%MOD <