import numpy as np N, M = map(int, input().split()) A = list(map(int, input().split())) R = list(map(int, input().split())) cnt = [0] * N for r in R: cnt[r - 1] += 1 cnt *= 2 cnt.reverse() sz = len(A) + len(cnt) - 1 fft_len = 1 << (sz - 1).bit_length() ca = np.fft.rfft(A, fft_len) cc = np.fft.rfft(cnt, fft_len) X = np.fft.irfft(ca * cc, fft_len)[:sz] X = (X.real + 0.1).astype(np.int64) print(*X[N:N+N].tolist())