n,q = gets.split.map {|x| x.to_i}
s=gets.chop
arr = []
q.times {
  t,d = gets.split
  arr << [t,d]
}

left = 0
right = s.size - 1
arr.reverse.each { |v|
  if v[1] == "L" and s[left] == v[0]
    left += 1
  end
  if v[1] == "R" and s[right] == v[0]
    right -= 1
  end
}

if right - left + 1 < 0
  puts 0
else
  puts right - left + 1
end
