#include using namespace std; using std::cout; using std::cin; using std::endl; using ll=long long; using ld=long double; ll ILL=2167167167167167167; const int INF=2100000000; const ll mod=998244353; #define rep(i,a) for (ll i=0;i using _pq = priority_queue, greater>; template ll LB(vector &v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();} template ll UB(vector &v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();} template bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}else return 0;} template bool chmax(T &a,const T &b){if(a void So(vector &v) {sort(v.begin(),v.end());} template void Sore(vector &v) {sort(v.begin(),v.end(),[](T x,T y){return x>y;});} void yneos(bool a){if(a) cout<<"Yes\n"; else cout<<"No\n";} template void vec_out(vector &p){for(int i=0;i<(int)(p.size());i++){if(i) cout<<" ";cout< using namespace atcoder; //参考 https://nyaannyaan.github.io/library/fps/formal-power-series.hpp.html namespace po167{ long long rev(long long a,long long MOD){ long long D=1,C=MOD-2; while(C){ if(C&1) D=(D*a)%MOD; C>>=1; a=(a*a)%MOD; } return D; } std::vector differential_Polynomial(std::vector p){ int N=p.size(); std::vector r(N); for(int i=1;i std::vector Integral_Polynomial(std::vector p){ int N=p.size(); std::vector r(1+N); std::vector rev(N+1,1); for(int i=0;i1){ rev[i+1]=(mod-((mod/(i+1))*rev[mod%(i+1)])%mod)%mod; } r[i+1]=(rev[i+1]*p[i])%mod; } return r; } // return f^{-1} mod x^{L} // https://judge.yosupo.jp/submission/79004 template std::vector inv_FPS(int N,int L,std::vector &p){ assert((int)p.size()==N); assert(0 q={1},tmp,tmp2; long long D=p[0]; long long C=mod-2; while(C){ if(C&1){ q[0]=(q[0]*D)%mod; } C>>=1; D=(D*D)%mod; } int S=1; while(S(tmp,convolution(q,q)); for(int i=0;i ans(S); for(int i=0;i>t; rep(i,t) solve(); } void solve(){ int N,K; cin>>N>>K; vector E(N+1),F(N+1); rep(i,N) cin>>E[i+1],F[i+1]=(mod-E[i+1])%mod; F[0]=1; auto ans0=po167::inv_FPS(1+N,N+167,F); ans0[0]=0; vector X,Y; auto _E=po167::differential_Polynomial(E); rep(i,N){ if(_E[i]!=0){ X.resize(N+1-i); Y.resize(N-i); rep(j,N-i){ Y[j]=_E[j+i]; X[j+1]=E[j+i+1]; } break; } } auto Y_inv=po167::inv_FPS((int)(Y).size(),N+3,Y); while(K>0){ ans0=po167::differential_Polynomial(ans0); ans0=convolution(ans0,X); ans0.resize(N+167); ans0=convolution(ans0,Y_inv); ans0.resize(N+167); K--; } X.erase(X.begin()); auto X_inv=po167::inv_FPS(X.size(),N+167,X); while(K<0){ ans0.erase(ans0.begin()); ans0=convolution(ans0,X_inv); ans0.resize(N+167); ans0=convolution(ans0,Y); ans0.resize(N+167); ans0=po167::Integral_Polynomial(ans0); K++; } rep(i,N){ if(i!=0) cout<<" "; cout<