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