from collections import deque N,M=map(int,input().split()) A=deque(list(map(int,input().split()))) S=input() for s in S: if s=="L": a=A.popleft() A.append(0) A[0]+=a else: a=A.pop() A.appendleft(0) A[-1]+=a print(*A)