P = 998244353 K = 216 KK = 1 << K N, Q = map(int, input().split()) A = [1] * N + [KK + (int(a) - 1) % P for a in input().split()] pa1 = (1 << 144) - ((1 << 144) % P) pa2 = (1 << 96) - ((1 << 96) % P) pa3 = (1 << 64) - ((1 << 64) % P) def modP(x): x -= ((x & m1) >> 144) * pa1 x -= ((x & m2) >> 96) * pa2 x -= ((x & m3) >> 64) * pa3 return x for i in range(N)[::-1]: if i == N - 1 or i and 1 << i.bit_length() - 1 == i: if i == N - 1: c = 2 else: c *= 2 m1 = int(("1" * 72 + "0" * 144) * c, 2) m2 = int(("1" * 120 + "0" * 96) * c, 2) m3 = int(("1" * 152 + "0" * 64) * c, 2) A[i] = modP(A[2*i] * A[2*i+1]) t = bin(A[1])[2:] + "_" X = [int(t[-(i+1) * K - 1:-i * K - 1], 2) % P for i in range((len(t)+K-2) // K)] for a in [int(a) for a in input().split()]: print(X[a])