from collections import deque n, m = map(int, input().split()) a = list(map(int, input().split())) s = input() rmax = 0 lmax = 0 now = 0 for i in s: if i == "L": now -= 1 else: now += 1 rmax = max(rmax, now) lmax = max(lmax, -now) now = min(now, n-1) now = max(now, -n) ans = [0] * n if rmax + lmax >= n - 1: ans[now] = sum(a) else: for i in range(lmax): a[lmax] += a[i] a[i] = 0 for i in range(rmax): a[n-1-rmax] += a[n-1-i] a[n-1-i] = 0 if now >= 0: for i in range(now, n): ans[i] = a[i-now] else: for i in range(n+now): ans[i] = a[i-now] print(*ans)