#!/usr/bin/env python3 # # No.1307 Rotate and Accumulate # import sys, os, math def ntt(a, inverse=False, mod=(119 << 23) + 1, root=3): n = 1 while n < len(a): n <<= 1 if len(a) < n: a += [0] * (n - len(a)) r = [0] * n for i in range(len(r)): r[i] = mod - pow(root, (mod - 1) >> (i + 2), mod) if not inverse: k = n >> 1 while k != 0: w = 1 for s in range(0, n, 2 * k): for i in range(s, s + k): u = a[i]; v = a[i + k] * w % mod a[i] = (u + v) % mod a[i + k] = (u - v + mod) % mod z = 0; x = s // 2 // k + 1 while x and x % 2 == 0: z += 1; x >>= 1 w = w * r[z] % mod k >>= 1 else: ir = [0] * n for i in range(len(r)): ir[i] = pow(r[i], mod - 2, mod) k = 1 while k < n: w = 1 for s in range(0, n, 2 * k): for i in range(s, s + k): u = a[i]; v = a[i + k] a[i] = (u + v) % mod a[i + k] = (u - v + mod) % mod * w % mod z = 0; x = s // 2 // k + 1 while x and x % 2 == 0: z += 1; x >>= 1 w = w * ir[z] % mod k <<= 1 n_1 = pow(n, mod - 2, mod) for i in range(len(a)): a[i] = a[i] * n_1 % mod def multiply(a, b): n = 1 while n < len(a) + len(b): n <<= 1 f, g = [0] * n, [0] * n for i, v in enumerate(a): f[i] = v for i, v in enumerate(b): g[i] = v ntt(f); ntt(g) for i in range(n): f[i] *= g[i] ntt(f, True) return f def read_ints(): return list(map(int, input().split())) n, q = read_ints() a, r = read_ints(), read_ints() f = a + a g = [0] * (n + 1) for x in r: g[n - x] += 1 c = multiply(f, g) print(" ".join(map(str, c[n:n + n])))