n,q=map(int,input().split())
s=list(input())
mag={}
cnt=0

for _ in range(q):
  t,d=map(int,input().split())
  if t not in mag:
    if d=='L':
      mag[t]=-1
    else:
      mag[t]=1
  else:
    if d=='L':
      mag[t]+=-1
    else:
      mag[t]+=1
      
for i,l in enumerate(s):
  if i+1+mag[l]<=0 or i+1+mag[l]>n:
    continue
  else:
    cnt+=1