N, Q = map(int, input().split())
S = ' ' + input() + ' '

ps = [0, N+1]
dirs = { 'L': 1, 'R': -1 }
QS = [input().split() for _ in range(Q)][::-1]
p = 0
for t, d in QS:
  np = p + dirs[d]
  if dirs[d] == -1:
    if S[p] == t:
      if 0 <= np <= N+1 and S[np] == t:
        p = np
  else:
    if 0 <= np <= N+1 and S[np] == t:
      p = np
p1 = p
p = N+1
for t, d in QS:
  np = p + dirs[d]
  if dirs[d] == 1:
    if S[p] == t:
      if 0 <= np <= N+1 and S[np] == t:
        p = np
  else:
    if 0 <= np <= N+1 and S[np] == t:
      p = np
p2 = p
print(max(0, p2 - p1 - 1))