import copy
import sys

n, q = map(int, sys.stdin.readline().split())

s = input()

leftLimit = -1
rightLimit = n

spells =   spell = sys.stdin.readlines()
  
for spell in reversed(spells):
  target, direction = spell.split()
  if direction == "R" and target == s[rightLimit - 1]:
    rightLimit -= 1
  if direction == "L" and target == s[leftLimit + 1]:
    leftLimit += 1

print(max(rightLimit - leftLimit - 1 , 0))
