local n, q = io.read("*n", "*n", "*l")
local s = io.read()
local t = {}
for i = 1, n do t[i] = s:sub(i, i):byte() end
local target, way = {}, {}
for i = 1, q do
  local strt, strway = io.read():match("(%w) (%w)")
  target[i] = strt:byte()
  way[i] = strway == "R"
end
local function solve(x)
  local result = 0
  for i = 1, q do
    if t[x] == target[i] then
      if way[i] then
        if x < n then x = x + 1
        else result = 1 break
        end
      else
        if 1 < x then x = x - 1
        else result = -1 break
        end
      end
    end
  end
  return result
end
local leftok = n + 1
if 0 <= solve(n) then
  leftok = n
  if 0 <= solve(1) then
    leftok = 1
  else
    local leftng = 1
    while 1 < leftok - leftng do
      local leftmid = (leftok + leftng) // 2
      if 0 <= solve(leftmid) then
        leftok = leftmid
      else
        leftng = leftmid
      end
    end
  end
end
local rightok = 0
if solve(1) <= 0 then
  rightok = 1
  if solve(n) <= 0 then
    rightok = n
  else
    local rightng = n
    while 1 < rightng - rightok do
      local rightmid = (rightng + rightok) // 2
      if solve(rightmid) <= 0 then
        rightok = rightmid
      else
        rightng = rightmid
      end
    end
  end
end
print(math.max(0, rightok - leftok + 1))
