N,Q=map(int,input().split())
S="ll"+input()+"rr"
jumon=[]
for i in range(Q):
  t,d=input().split()
  jumon.append([t,d])
s=1
t=N+2
for i in range(-1,-Q-1,-1):
  if jumon[i][0]==S[s+1] and jumon[i][1]=="L":
    s+=1
  if jumon[i][0]==S[s-1] and jumon[i][1]=="R":
    s-=1
  if jumon[i][0]==S[t+1] and jumon[i][1]=="L":
    t+=1
  if jumon[i][0]==S[t-1] and jumon[i][1]=="R":
    t-=1
print(max(0,t-s-1))