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