N,M=map(int, input().split()) A=list(map(int, input().split())) s=input() c=0 cmi,cma=0,0 for i in s: if i=='L': c-=1 else: c+=1 if c<-1*(N-1): c+=1 if c>(N-1): c-=1 cmi=min(cmi,c) cma=max(cma,c) cmi*=(-1) d=0 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 if c==0: print(*A) elif c>0: ans=[0]*c for i in range(N-c): ans.append(A[i]) print(*ans) else: c*=-1 ans=[] for i in range(c,N): ans.append(A[i]) ans=ans+[0]*c print(*ans)