N, Q = map(int, input().split())
s = input()
td = [list(input().split()) for _ in range(Q)]

cnt = 0
td.reverse()

for i in range(Q):
  if td[i] == [s[0], "L"]:
    cnt += 1
    k = 1
    for j in range(i + 1, Q - i - 1):
      if td[j] == [s[k], "L"]:
        cnt += 1
        k += 1
      elif td[j] == [s[k], "R"] or td[j] == [s[0], "L"]:
        break
  elif td[i] == [s[-1], "R"]:
    if td[i] == [s[-1], "R"]:
      cnt += 1
      k = 1
      for j in range(i + 1, Q - i - 1):
        if td[j] == [s[-(k + 1)], "R"]:
          cnt += 1
          k += 1
        elif td[j] == [s[-(k + 1)], "L"] or td[j] == [s[-1], "R"]:
          break

print(N - cnt)