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()

dp = [set() for _ in range(Q)]
for i in range(Q):
  t, d = q[i]
  if t == s[0] and d == 'L':
    dp[i].add(0)
  elif t == s[N-1] and d == 'R':
    dp[i].add(N-1)
  
  if i == 0:
    continue

  for p in dp[i-1]:
    dp[i].add(p)
    if p-1 >= 0 and t == s[p-1] and d == 'R':
      dp[i].add(p-1)
    elif p+1 <= N-1 and t == s[p+1] and d == 'L':
      dp[i].add(p+1)

print(N-len(dp[Q-1]))