from collections import defaultdict
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
s = input()
q = []
for _ in range(Q):
  q.append(input().split())
q.reverse()

l = 0
r = N-1
for i in range(Q):
  t, d = q[i]
  if t == s[l] and d == 'L':
    l += 1
  if t == s[r] and d == 'R':
    r -= 1
  if l > r:
    print(0)
    sys.exit()
print(r-l+1)