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