import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") import numpy as np # FFT import numpy as np M = 998244353 a = np.array(a, dtype=np.int64) b = np.array(b, dtype=np.int64) def fft(a,b): l = 1 while 2 * l < len(a) + len(b) - 1: l *= 2 l *= 2 c = np.fft.irfft((np.fft.rfft(a,l))*(np.fft.rfft(b,l)),l) c = np.rint(c).astype(np.int64) return c def fft_large(a,b): d = 30000 a1, a2 = np.divmod(a,d) b1, b2 = np.divmod(b,d) aa = fft(a1,b1) % M bb = fft(a2,b2) % M cc = (fft(a1+a2, b1+b2) - (aa+bb)) % M h = (((aa*d)%M)*d + cc*d + bb) % M return h def fft_large(a,b): """精度が足りないときはこちら """ d = 1<<10 a1, a2 = np.divmod(a,d*d) a2, a3 = np.divmod(a2,d) b1, b2 = np.divmod(b,d*d) b2, b3 = np.divmod(b2,d) aa = fft(a1,b1) % M bb = fft(a2,b2) % M cc = fft(a3,b3) % M dd = (fft(a1+a2, b1+b2) - (aa+bb)) % M ee = (fft(a2+a3, b2+b3) - (bb+cc)) % M ff = (fft(a1+a3, b1+b3) - (aa+cc)) % M h = (((aa*d*d)%M)*d*d + ((dd*d*d)%M)*d + (bb+ff)*d*d + ee*d + cc) % M return h n,q = list(map(int, input().split())) a = np.array(list(map(int, input().split())), dtype=np.int64) # r = np.array(list(map(int, input().split())), dtype=np.int64) r = list(map(int, input().split())) c = [0]*n for num in r: c[(-num)%n] += 1 v = fft_large(a,c) vv = (v[:n] + v[n:2*n]).tolist() write(" ".join(map(str, vv)))