import sys input=lambda: sys.stdin.readline().rstrip() n,m=map(int,input().split()) A=[int(i) for i in input().split()] S=input() ct1,ct2,ct3=0,0,0 for s in S: if s=="L": if ct1==-(n-1): continue else: ct1-=1 else: if ct1==n-1: continue else: ct1+=1 ct2=max(ct1,ct2) ct3=min(ct1,ct3) Ans=[0]*n for i in range(n): if i=n-1-ct2: Ans[n-1-ct2+ct1]+=A[i] else: Ans[i+ct1]+=A[i] print(*Ans)