N, M = map(int, input().split()) a = list(map(int, input().split())) S = input() t = 0 for c in S: if c == 'L': t = max(t - 1, -N + 1) if t < 0: a[-t] += a[-(t + 1)] a[-(t + 1)] = 0 elif c == 'R': t = min(t + 1, N - 1) if t > 0: a[N - 1 - t] += a[N - t] a[N - t] = 0 if t > 0: print(*(([0] * t) + a)[:N]) elif t < 0: print(*(a + ([0] * -t))[-t:N - t]) else: print(*a)