from collections import deque n,m = map(int,input().split()) ai = [int(i) for i in input().split()] s = input() d = deque(ai) for i in range(m): if s[i] == 'L': tmp = d.popleft() d[0] = d[0]+tmp d.append(0) else: tmp = d.pop() d[-1] = d[-1]+tmp d.appendleft(0) print(*d)