def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N,M=MI() A=LI() from collections import deque dq=deque(A) S=input() for i in range(M): if S[i]=="L": a=dq.popleft() b=dq.popleft() dq.appendleft(a+b) dq.append(0) else: a=dq.pop() b=dq.pop() dq.append(a+b) dq.appendleft(0) ans=[] for i in range(N): ans.append(dq.popleft()) print(' '.join(map(str, ans))) main()