#include #include using namespace std; #define reps(i,s,n) for(int i = s; i < n; i++) #define rep(i,n) reps(i,0,n) #define Rreps(i,n,e) for(int i = n - 1; i >= e; --i) #define Rrep(i,n) Rreps(i,n,0) #define ALL(a) a.begin(), a.end() #define fi first #define se second typedef long long ll; typedef vector vec; typedef vector mat; ll N,M,H,W,Q,K,A,B; string S; const ll MOD = 998244353; //const ll MOD = (1e+9) + 7; typedef pair P; const ll INF = (1LL<<62); typedef complex cm; typedef vector vcm; #define pi 3.1415926535 vcm dft(int n, vcm f, bool inv){ if(n == 1) return f; int n2 = n / 2; vcm f1(n2), f2(n2); rep(i,n) (!(i & 1) ? f1[i/2] : f2[i/2]) = f[i]; f1 = dft(n2, f1, inv); f2 = dft(n2, f2, inv); cm zeta = polar(1.0, (inv ? -2.0 : 2.0) * pi / n); cm pow_zeta = cm(1); rep(i, n2){ f[i] = f1[i] + pow_zeta * f2[i]; pow_zeta *= zeta; } if(pow_zeta.real() > -0.99) cout< n) n *= 2; g.resize(n); h.resize(n); vcm g_hat = dft(n, g, false), h_hat = dft(n, h, false); vcm gh_hat(n); rep(i,n) gh_hat[i] = g_hat[i] * h_hat[i]; vcm gh = dft(n, gh_hat, true); rep(i, n) gh[i] /= cm(n); gh.resize(sz); return gh; } int main() { cin>>N>>Q; vec a(N); rep(i,N) { cin>>a[i]; --a[i]; } const int max_log = 18; const ll mod = 998244353; vector vs(max_log + 1, mat(0)); rep(i,N) vs[0].push_back({1, a[i]}); int last = max_log; rep(i,max_log){ if(vs[i].size() == 1) { last = i; break; } rep(j, vs[i].size() / 2){ vector temp(2, vcm(0)); rep(k,2) for(ll v : vs[i][j * 2 + k]) temp[k].emplace_back(v); vcm res = convolution(temp[0], temp[1]); vec pu(0); //cout<>A; cout<