n,m=map(int,input().split()) n+=1 s=input() x=y=0 vis=[[1]*n for i in range(n)] vis[0][0]=0 for c in s: if c=='R': x+=1 elif c=='L': x-=1 elif c=='U': y+=1 elif c=='D': y-=1 if 0<=x