N,M = map(int,input().split()) A = list(map(int,input().split())) S = str(input()) for i in range(M): if S[i] == "L": A = [A[0]+A[1]]+A[2:]+[0] else: A = [0]+A[:-2]+[A[-2]+A[-1]] print(*A)