N,M=map(int,input().split()) A=list(map(int,input().split())) S=input() m=0 x,y=0,0 for d in S: if d=="L": a=A.pop(0) A[0]+=a A.append(0) else: a=A.pop() A[-1]+=a A=[0]+A for i in range(N): print(A[i],end=" ") print()