#include using namespace std; int MOD=1000000007; template class Matrix{ public: vector> value; Matrix(vector> e){ value=e; } Matrix operator * (Matrix a){ vector> ret(value.size(),vector(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 pow(int 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 b(vector>(n,vector(1,1))); vector> Av(n,vector(n,0)); vector a(n); for(int i=0;i>a[i]; } for(int i=0;i A(Av); Matrix p=A.pow(c); long long ans=(A.pow(c)*b).value[n-1][0]; for(int i=0;i