import sys
input = sys.stdin.readline

N, Q = map(int,input().split())
S = "0"+input()+"0"
TD = [input().rstrip().split() for _ in range(Q)]
l, r = 0, N+1
for t, d in TD[::-1]:
  if t == S[l] and d == "R":
    l -= 1
  elif t == S[l+1] and d == "L":
    l += 1
  if t == S[r] and d == "L":
    r += 1
  elif t == S[r-1] and d == "R":
    r -= 1
print(max(0, r-l-1))