n,q = gets.split.map &:to_i
s = gets.chomp

t = []
d = []

q.times do |i|
  t[i], d[i] = gets.split
end

l_current = -1
l_max = -1

r_current = n
r_min = n

q.times do |i|
  ti = t[q-i-1] #文字
  di = d[q-i-1] #どっちに行ったか

  if di == "L"
    if l_current + 1 < n && s[l_current+1] == ti
      l_current += 1
      l_max = [l_max, l_current].max
    end

    if r_current + 1 < n && r_current + 1 < n && s[r_current+1] == ti
      r_current -= 1
    end
  else
    if l_current >= 0 && s[l_current-1] == ti
      l_current -= 1
    end

    if r_current - 1 >= 0 && s[r_current-1] == ti
      r_current -= 1
      r_min = [r_min, r_current].min
    end
  end
end

if l_max >= r_min
  puts 0
  exit
end

puts n - (l_max + 1) - (n - r_min)