mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline N, Q = map(int, input().split()) A = list(map(int, input().split())) A.reverse() R = list(map(int, input().split())) B = [0] * N for r in R: B[r] += 1 S = 0 for a in A: S <<= 30 S += a ans = 0 for i in range(N): ans += S * B[i] S >>= 30 S += A[N-1-i] << (30 * (N-1)) C = [0] * N for i in range(N): C[i] = ans % (1<<30) ans >>= 30 print(*C) if __name__ == '__main__': main()