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