from collections import deque import sys input = sys.stdin.readline N, M = map(int, input().split()) dq = deque(map(int, input().split())) for c in input().rstrip(): if c == 'L': x = dq.popleft() dq[0] += x dq.append(0) else: x = dq.pop() dq[-1] += x dq.appendleft(0) print(*dq)