#include #include namespace my{ using namespace std; using ml=atcoder::modint998244353; auto&operator>>(istream&i,ml&x){int t;i>>t;x=t;return i;} auto&operator<<(ostream&o,const ml&x){return o<__VA_ARGS__;setsize({n},__VA_ARGS__);lin(__VA_ARGS__) #define FO(n) for(ll ij=n;ij--;) #define FOR(i,...) for(auto[i,i##stop,i##step]=range(0,__VA_ARGS__);isync_with_stdio(0);cout<auto min(const A&...a){return min(initializer_list>{a...});} templatestruct pair{ A a;B b; pair()=default; pair(A a,B b):a(a),b(b){} pair(const std::pair&p):a(p.first),b(p.second){} auto operator<=>(const pair&)const=default; friend ostream&operator<<(ostream&o,const pair&p){return o<ostream&operator<<(ostream&o,const std::pair&p){return o<ostream&operator<<(ostream&o,const array&a){fo(i,n)o<struct priority_queue:std::priority_queue,F>{ arrayone; priority_queue(const initializer_list&a={}){fe(a,e)this->emplace(e);} priority_queue(const vector&a){fe(a,e)this->emplace(e);} auto begin(){*one.begin()=this->top();return one.begin();} void pop_front(){this->pop();} friend ostream&operator<<(ostream&o,priority_queue q){while(q.size())o<0,sp);return o;} }; templateusing min_heap=priority_queue>; templateconcept vectorial=is_base_of_v,V>; templatestruct core_type{using type=T;}; templatestruct core_type{using type=typename core_type::type;}; templateusing core_t=core_type::type; templateistream&operator>>(istream&i,vector&v){fe(v,e)i>>e;return i;} templateostream&operator<<(ostream&o,const vector&v){fe(v,e)o<?nl:sp);return o;} templatestruct vec:vector{ using vector::vector; vec(const vector&v){vector::operator=(v);} vec&operator^=(const vec&u){this->insert(this->end(),u.begin(),u.end());return*this;} vec operator^(const vec&u)const{return vec{*this}^=u;} vec&operator++(){fe(*this,e)++e;return*this;} vec&operator--(){fe(*this,e)--e;return*this;} vec slice(ll l,ll r)const{return vec(this->begin()+l,this->begin()+r);} auto scan(const auto&f)const{pair,bool>r{};fe(*this,e)if constexpr(!vectorial)r.b?f(r.a,e),r:r={e,1};else if(auto s=e.scan(f);s.b)r.b?f(r.a,s.a),r:r=s;return r;} auto min()const{return scan([](auto&a,const auto&b){a>b?a=b:0;;}).a;} }; templateauto make_vec(const ll(&s)[n],T x={}){if constexpr(n==i+1)return vec(s[i],x);else{auto X=make_vec(s,x);return vec(s[i],X);}} templatevoid setsize(const ll(&l)[n],A&...a){((a= make_vec(l,core_t())),...);} void lin(auto&...a){(cin>>...>>a);} templatevoid pp(const auto&...a){ll n=sizeof...(a);((cout<0,c)),...);cout<auto inv_enumerate(ll n){ vecr(n+1); r[1]=1; fo(i,2,n+1)r[i]=-r[T::mod()%i]*(T::mod()/i); return r; } templateT mod(T a,T m){return(a%=m)<0?a+m:a;} namespace fft{ using real=double; struct complex{ real x,y; complex()=default; complex(real x,real y):x(x),y(y){} inline complex operator+(const complex &c)const{return complex(x+c.x,y+c.y);} inline complex operator-(const complex &c)const{return complex(x-c.x,y-c.y);} inline complex operator*(const complex &c)const{return complex(x*c.x-y*c.y,x*c.y+y*c.x);} inline complex conj()const{return complex(x,-y);} }; const real PI=acosl(-1); ll base=1; vectorrts={{0,0},{1,0}}; vectorfft_rev={0,1}; void ensure_base(int nbase){ if(nbase<=base)return; fft_rev.resize(1<>1]>>1)+((i&1)<<(nbase-1)); while(base&a,int n){ assert((n&(n-1))==0); int zeros=__builtin_ctz(n); ensure_base(zeros); int shift=base-zeros; fo(i,n)if(i<(fft_rev[i]>>shift))swap(a[i],a[fft_rev[i]>>shift]); for(int k=1;kstruct arbitrary_mod_convolution{ using real=fft::real; using complex=fft::complex; arbitrary_mod_convolution(){} std::vectormultiply(const std::vector&a,const std::vector&b,int need=-1){ if(need==-1)need=a.size()+b.size()-1; int nbase=0; while((1<fa(sz); fo(i,a.size())fa[i]=complex(a[i].val()&((1<<15)-1),a[i].val()>>15); fft::fast_fourier_transform(fa,sz); std::vectorfb(sz); if(a==b){ fb=fa; }else{ fo(i,b.size())fb[i]=complex(b[i].val()&((1<<15)-1),b[i].val()>>15); fft::fast_fourier_transform(fb,sz); } real ratio=0.25/sz; complex r2(0,-1),r3(ratio,0),r4(0,-ratio),r5(0,1); for(int i=0;i<=(sz>>1);i++){ int j=(sz-i)&(sz-1); complex a1=(fa[i]+fa[j].conj()); complex a2=(fa[i]-fa[j].conj())*r2; complex b1=(fb[i]+fb[j].conj())*r3; complex b2=(fb[i]-fb[j].conj())*r4; if(i!=j){ complex c1=(fa[j]+fa[i].conj()); complex c2=(fa[j]-fa[i].conj())*r2; complex d1=(fb[j]+fb[i].conj())*r3; complex d2=(fb[j]-fb[i].conj())*r4; fa[i]=c1*d1+c2*d2*r5; fb[i]=c1*d2+c2*d1; } fa[j]=a1*b1+a2*b2*r5; fb[j]=a1*b2+a2*b1; } fft::fast_fourier_transform(fa,sz); fft::fast_fourier_transform(fb,sz); std::vectorret(need); fo(i,need){ int64_t aa=llround(fa[i].x); int64_t bb=llround(fb[i].x); int64_t cc=llround(fa[i].y); aa=T(aa).val(),bb=T(bb).val(),cc=T(cc).val(); ret[i]=aa+(bb<<15)+(cc<<30); } return ret; } }; templatestruct formal_power_series:vec{ using vec::vec; using fps=formal_power_series; static inline arbitrary_mod_convolutionfft; static fps mul(const fps&a,const fps&b){ if constexpr(T::mod()==998244353)return convolution(a,b); else return fft.multiply(a,b); } auto operator<=>(const fps&f)const{return this->size()<=>f.size();} fps pre(ll deg)const{fps r(this->begin(),this->begin()+min((ll)this->size(),deg));r.resize(deg);return r;} fps&operator+=(const fps&f){if(f.size()>this->size())this->resize(f.size());fo(i,f.size())(*this)[i]+=f[i];return*this;} fps&operator-=(const fps&f){if(f.size()>this->size())this->resize(f.size());fo(i,f.size())(*this)[i]-=f[i];return*this;} fps&operator*=(const fps&f){return*this=(this->size()&&f.size()?mul(*this,f):fps{});} fps&operator>>=(ll sz){if((ll)this->size()<=sz)return*this=fps{};this->erase(this->begin(),this->begin()+sz);return*this;} fps&operator<<=(ll sz){this->insert(this->begin(),sz,T{});return*this;} fps&operator/=(const fps&f){ ll I1,I2; for(I1=0;I1size()&&(*this)[I1]==0;++I1); for(I2=0;I2=I2); return*this=((*this>>I2)*(f>>I2).inv(this->size())).pre(this->size()); } fps operator+(const fps&f)const{return fps{*this}+=f;} fps operator-(const fps&f)const{return fps{*this}-=f;} fps operator*(const fps&f)const{return fps{*this}*=f;} fps operator/(const fps&f)const{return fps{*this}/=f;} fps operator-()const{auto r=*this;fe(r,x)x=-x;return r;} fps operator>>(ll sz)const{return fps{*this}>>=sz;} fps operator<<(ll sz)const{return fps{*this}<<=sz;} fps&operator+=(const T&c){if(!this->size())this->resize(1);(*this)[0]+=c;return*this;} fps&operator-=(const T&c){if(!this->size())this->resize(1);(*this)[0]-=c;return*this;} fps&operator*=(const T&c){fo(i,this->size())(*this)[i]*=c;return*this;} fps operator+(const T&c)const{return fps{*this}+=c;} fps operator-(const T&c)const{return fps{*this}-=c;} fps operator*(const T&c)const{return fps{*this}*=c;} T operator()(T x)const{T r=0,xi=1;fe(*this,ai)r+=ai*xi,xi*=x;return r;} fps differential()const{ assert(this->size()); fps r(this->size()-1); fo(i,r.size())r[i]=(*this)[i+1]*T{i+1}; return r; } fps integral()const{ fps r(this->size()+1); auto iv=inv_enumerate(r.size()); fo(i,r.size()-1)r[i+1]=(*this)[i]*iv[i+1]; return r; } fps inv(ll deg=-1)const{ assert((*this)[0]!=T{}); if(deg==-1)deg=this->size(); fps r{T{1}/(*this)[0]}; for(ll i=1;ipre(i<<1)*(r*r)).pre(i<<1); return r.pre(deg); } fps log(ll deg=-1)const{ assert((*this)[0]==T{1}); if(deg==-1)deg=this->size(); return(differential()*inv(deg)).integral().pre(deg); } static fps prod(const vec&F){ if(F.size()==0)return fps{1}; min_heapq; fe(F,f)q.emplace(f); while(q.size()>1){ auto f=q.top();q.pop(); auto g=q.top();q.pop(); q.emplace(f*g); } return q.top(); } }; templateusing fps=formal_power_series; templateauto power_sum_enumerate(const vec&a,ll M){ ll N=a.size(); vec>f(N); fo(i,N)f[i]={1,-a[i]}; auto r=-fps::prod(f).log(M+1); fo(i,1,M+1)r[i]*=i; r[0]=N; return r; } single_testcase void solve(){ LL(N,M); VRD(ml,N,a); pp(power_sum_enumerate(a,M).slice(1,M+1)); }}