#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 10000000000000000 template struct matrix{ vector> v; int _h,_w; matrix(vector> X){ v = X; _h = X.size(); _w = 0; if(X.size()>0)_w = X[0].size(); } matrix(int h,int w){ v.resize(h,vector(w,e0())); _h = h; _w = w; } void add_element(int from,int to,S x){ v[to][from] = op0(v[to][from],x); } matrix e(){ assert(_h==_w); matrix ret(_h,_w); for(int i=0;i<_h;i++){ for(int j=0;j<_w;j++){ if(i==j)ret.v[i][j] = e1(); else ret.v[i][j] = e0(); } } return ret; } matrix &operator*=(const matrix &another){ matrix ret(_h,another._w); for(int i=0;i<_h;i++){ for(int j=0;j ret = e(); auto temp = *this; while(cnt!=0LL){ if((cnt&1)==1){ ret *= temp; } temp *= temp; cnt>>=1; } return ret; } }; long long op0(long long a,long long b){ return min(a,b); } long long e0(){ return Inf; } long long op1(long long a,long long b){ return a+b; } long long e1(){ return 0; } int main(){ long long N,V; cin>>N>>V; long long ans = 0LL; vector C(N); rep(i,N){ cin>>C[i]; ans += C[i]; V --; } if(V<0){ cout< M(N,N); rep(i,N-1){ M.add_element(i,i+1,0); } rep(i,N){ M.add_element(i,0,C[i]); } matrix temp(1,N); temp.v[0][0] = ans; temp *= M.pow(V); cout<