import sys, math sys.setrecursionlimit(10**8) sys.set_int_max_str_digits(0) INF = 10**18 MOD = 998244353 from bisect import bisect_left, bisect_right from collections import deque, defaultdict, Counter from itertools import product, combinations, permutations, groupby, accumulate N, M = map(int, input().split()) A = list(map(int, input().split())) S = input() pos = [0] # 二人だけ位置を追う a1, aN = 0, N - 1 for s in S: if s == 'L': pos.append(pos[-1] - 1) if a1 != 0: a1 -= 1 if aN != 0: aN -= 1 else: pos.append(pos[-1] + 1) if a1 != N - 1: a1 += 1 if aN != N - 1: aN += 1 left = min(pos) right = max(pos) # 最終的な相対位置 memo = pos[-1] # index: 1 ~ left の数字は a1 にマージ # index: N - right ~ N - 2 の数字は aN にマージ ans = [0] * N ans[a1] += A[0] ans[aN] += A[-1] for i in range(1, N - 1): if 1 <= i <= left: ans[a1] += A[i] elif N - right <= i <= N - 2: ans[aN] += A[i] else: ans[i + memo] += A[i] print(*ans)