#include <bits/stdc++.h>
using namespace std;
int MOD=1000000007;
template<typename type=int>
class Matrix{
public:
    vector<vector<type>> value;
    Matrix(vector<vector<type>> e){
        value=e;
    }
    Matrix<type> operator * (Matrix a){
        vector<vector<type>> ret(value.size(),vector<type>(a.value[0].size()));
        type temp;
        for(int i=value.size()-1;i>=0;i--){
            for(int j=a.value[0].size()-1;j>=0;j--){
                temp=0;
                for(int k=a.value.size()-1;k>=0;k--){
                    temp=(temp+value[i][k]*a.value[k][j])%MOD;
                }
                ret[i][j]=temp;
            }
        }
        return Matrix(ret);
    }
    Matrix<type> pow(long long p){
        Matrix temp=value;
        Matrix ans=temp;
        bool flg=false;
        while(p>0){
            if(p%2){
                if(flg){
                    ans=ans*temp;
                }else{
                    flg=true;
                    ans=temp;
                }
            }
            p=p/2;
            temp=temp*temp;
        }
        return ans;
    }
};

long long pawf(long long a,long long n){
    long long ans=1;
    long long temp=a%MOD;
    while(n>0){
        if(n%2){
            ans=(ans*temp)%MOD;
        }
        temp=(temp*temp)%MOD;
        n=n/2;
    }
    return ans;
}

int main(){
    long long n,c;
    cin>>n>>c;
    Matrix<long long> b(vector<vector<long long>>(n,vector<long long>(1,1)));
    vector<vector<long long>> Av(n,vector<long long>(n,0));
    vector<long long> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<=i;j++){
            Av[i][j]=a[j]%MOD;
        }
    }

    Matrix<long long> A(Av);
    Matrix<long long> p=A.pow(c);
    long long ans=(A.pow(c)*b).value[n-1][0];
    for(int i=0;i<n;i++){
        ans=ans-pawf(a[i],c);
    }
    while(ans<0)ans+=MOD;
    cout<<ans<<endl;
}