import sys from collections import deque n, m = map(int, sys.stdin.readline().split()) a = deque(map(int, sys.stdin.readline().split())) s = sys.stdin.readline().rstrip() def main(): for c in s: if c == 'L': b = a.popleft() a.append(0) a[0] += b else: b = a.pop() a.appendleft(0) a[-1] += b print(*a, sep=' ') if __name__ == '__main__': main()