n,q= map(int,input().split())
s = [0]+list(input())+[0]
td = [input().split() for _ in range(q)]
l,r = 0,n+1
for i,j in td[::-1]:
  if s[l+1]==i and j=='L':
    l+=1
  elif s[l]==i and j=='R':
    l-=1
  if s[r-1]==i and j=='R':
    r-=1
  elif s[r]==i and j=='L':
    r+=1
print(max(0,r-l-1))