#include #include #include #include #include #include #include #include #include #include #include constexpr long long p=998244353; constexpr long long root=3; constexpr long long iroot=332748118; inline int ADD(const int a,const int b) { return a+b>=p?a+b-p:a+b; } inline int SUB(const int a,const int b) { return a-b<0?a-b+p:a-b; } void fail() { printf("-1\n"); exit(0); } int deg(const std::vector &a){ int ret=a.size()-1; while (ret>=0 && a[ret]==0) --ret; return ret; } std::vector trim(std::vector a,const int n) { int asize=a.size(); a.resize(n); for (int i=asize;i &a) { while (a.size()>1 && a.back()==0) a.pop_back(); } //f->fx^(shift) std::vector shift(std::vector &a,const int shift) { std::vector b(std::max(0,(int)a.size()+shift),0); for (int i=0;i<(int)b.size();++i) b[i]=(0<=i-shift&&i-shift<(int)a.size())?a[i-shift]:0; return b; } inline long long pow_mod(long long a,long long n) { long long ret=1; for (;n>0;n>>=1,a=a*a%p) if(n%2==1) ret=ret*a%p; return ret; } inline int inv(int a) { a%=p; if (a<0) a+=p; int u=p; int v=a; int s=0; int t=1; // sa=u // ta=v while (v!=0) { int q=u/v; s-=q*t;u-=q*v; std::swap(s,t); std::swap(u,v); } return s>=0?s:s+p; } void monic(std::vector &a) { norm(a); long long coe=inv(a.back()); for (int i=0;i<(int)a.size();++i) { a[i]=(int)(coe*a[i]%p); } } std::vector add(std::vector a,std::vector b) { int n=std::max(a.size(),b.size()); a.resize(n);b.resize(n); for (int i=0;i subtract(std::vector a,std::vector b) { int n=std::max(a.size(),b.size()); a.resize(n);b.resize(n); for (int i=0;i mul_naive(std::vector &a,std::vector &b) { std::vector ret(a.size()+b.size()-1,0); if (a.size() &from,std::vector &to,bool flag){ if (n==1) { if (flag) for (int i=0;i &from,std::vector &to,bool flag){ int w=pow_mod(g,(p-1)/n); long long w1,w2,w3; int i,src,n0,n1,n2,n3,A,B,C,D,apc,amc,bpd,jbmd; while (n>2) { n0=0; n1=n/4; n2=n1+n1; n3=n1+n2; w1=1; for (i=0;ito.size()) std::swap(from,to); } std::vector tmp_fft(1<<20); void fft(std::vector &a,int g) { fft4_(a.size(),g,pow_mod(g,(p-1)/4*3),1,a,tmp_fft,false); } // (sx^p+u)(tx^p+v) // =stx^(2p)+(sv+ut)x^p+uv // =stx^(2p)+((s+u)(t+v)-(st-uv))x^p+uv void mul_karatsuba(int a[],int b[],int c[],int res[],int n) { if (n<=8) { for (int i=0;i<2*n;++i) res[i]=0; for (int i=0;i mul_fft(std::vector a,std::vector b) { int n=1; int need=a.size()+b.size()-1; while (n karatsuba(std::vector &a,std::vector &b) { int need=std::max(a.size(),b.size()); int n=1; while (n a_=trim(a,n); std::vector b_=trim(b,n); std::vector c(4*n); std::vector res(4*n); mul_karatsuba(a_.data(),b_.data(),c.data(),res.data(),n); res.resize(a.size()+b.size()-1); return res; } std::vector mul(std::vector &a,std::vector &b) { if (std::min(a.size(),b.size())<=2) { return mul_naive(a,b); }else if (std::max(a.size(),b.size())<=64) { return karatsuba(a,b); } else { std::vector ret=mul_fft(a,b); norm(ret); return ret; } } std::vector mul(std::vector &a,int b) { int n=a.size(); std::vector c(n); for (int i=0;i>> mul(std::vector>> &a,std::vector>> &b) { std::vector>> ret(a.size(),std::vector>(b[0].size(),std::vector())); for (int i=0;i<(int)a.size();++i) { for (int j=0;j<(int)b[i].size();++j) { for (int k=0;k<(int)a[i].size();++k) { std::vector prd=mul(a[i][k],b[k][j]); if (ret[i][j].size() inv(std::vector &g) { int n=g.size(); std::vector f={inv(g[0])}; long long root=3; long long iroot=inv(3); for (int len=1;len f_fft=trim(f,2*len); std::vector g_fft=trim(g,2*len); fft(f_fft,root); fft(g_fft,root); long long isize=inv(2*len); for (int i=0;i<2*len;++i) g_fft[i]=(int)(1LL*g_fft[i]*f_fft[i]%p*isize%p); fft(g_fft,iroot); for (int i=0;i divide_naive(std::vector a,std::vector &b) { if (a.size() ret(n,0); norm(b); assert(deg(b)>=0); int ib=inv(b.back()); for (int i=n-1;i>=0;--i) { if (a[i+b.size()-1]==0) continue; ret[i]=1LL*ib*a[i+b.size()-1]%p; for (int j=0;j<(int)b.size();++j) { a[i+j]=(a[i+j]+1LL*b[j]*(p-ret[i]))%p; } } return ret; } std::vector divide_newton(std::vector a,std::vector b) { if (a.size() divide(std::vector &a,std::vector &b) { norm(a); norm(b); if (a.size() ret(1,0); return ret; } if (a.size()==b.size()) { return {(int)(1LL*inv(b.back())*a.back()%p)}; } else if (a.size()-b.size()=32) { int del=a.size()-2*(a.size()-b.size())-1; std::vector na=shift(a,-del); std::vector nb=shift(b,-del); return divide(na,nb); } else if (a.size()<32) { return divide_naive(a,b); } else { return divide_newton(a,b); } } std::vector mod(std::vector &a,std::vector &b) { std::vector q=divide(a,b); q=subtract(a,mul(b,q)); norm(q); return q; } int main() { int n,m; std::cin>>n>>m; std::vector a(n); for (int i=0;i>a[i]; std::deque> den; std::deque>> num; for (int i=0;i f{1,(int)(p-a[i])}; den.push_back(f); } for (int i=0;i f{1,(int)(p-a[i])}; std::vector g{1}; std::vector> h{f,g}; num.push_back(h); } while (den.size()>1) { std::vector f=den.front();den.pop_front(); std::vector g=den.front();den.pop_front(); den.push_back(mul(f,g)); } while (num.size()>1) { std::vector> f=num.front();num.pop_front(); std::vector> g=num.front();num.pop_front(); std::vector a=mul(f[0],g[0]); std::vector b=add(mul(f[0],g[1]),mul(f[1],g[0])); std::vector> ret{a,b}; num.push_back(ret); } std::vector denominator=den.front(); denominator.resize(m+1); denominator=inv(denominator); std::vector ans=mul(num.front()[1],denominator); for (int i=1;i<=m;++i) { std::cout<