N,M=map(int, input().split()) A=list(map(int, input().split())) s=input() L,R=0,N-1 d=0 cmi,cma=0,0 for i in s: if i=='L': L=max(0,L-1) R=max(0,R-1) d-=1 if d==-N: d+=1 cmi=min(d,cmi) else: L=min(N-1,L+1) R=min(N-1,R+1) d+=1 if d==N: d-=1 cma=max(d,cma) cmi*=-1 for i in range(cmi): A[i+1]+=A[i] A[i]=0 for i in range(cma): A[-2-i]+=A[-1-i] A[-1-i]=0 B=A[cmi:N-cma] ans=[0]*L+B+[0]*(N-R-1) print(*ans)