N,M=map(int,input().split()) A=list(map(int,input().split())) S=input() m=0 x,y=0,0 for d in S: if d=="L": m=max(m-1,-(N-1)) x=min(m,x) else: m=min(m+1,N-1) y=max(m,y) x=-x y=(N-1)-y for i in range(N): if i