import sys import numpy as np input = sys.stdin.readline N, Q = map(int, input().split()) a = list(map(int, input().split())) r = list(map(int, input().split())) ln = 1 << 4 A = np.zeros(ln) B = np.zeros(ln) for i in range(N): A[N - i - 1] = a[i] for q in r: B[q] += 1 C = np.fft.rfft(A) * np.fft.rfft(B) c = np.fft.irfft(C) res = [0] * N for i in range(len(c)): res[i % N] += c[i] res.reverse() res = [int(res[i] + 0.5) for i in range(N)] print(*res)