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