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