from numpy import fft as F;I=input;I();a=list(map(int,I().split()));b=[0]*len(a); for i in I().split():b[-int(i)]+=1 print(*(F.ifft(F.fft(a)*F.fft(b))+.5).astype(int))