# 各クラスがM回後にどこにいるか考えればいい # これで間に合うのか、もっとスマートな方法が必要なのか N, M = map(int, input().split()) A = list(map(int, input().split())) S = input() level = 0 floor, ceiling = 0, 0 for s in S: if s == 'R': level += 1 else: level -= 1 floor = min(floor, level) ceiling = max(ceiling, level) mx_list = [] mn_list = [] for i in range(N): mx_list.append(N-1-i) mn_list.append(-i) final = [0]*N for i in range(N): if ceiling <= mx_list[i] and mn_list[i] <= floor: final[i+level] += A[i] else: l = i for s in S: if s == 'R': l = min(l+1, N-1) elif s == 'L': l = max(l-1, 0) final[l] += A[i] print(*final)