N, Q = gets.split.map(&:to_i)
S = gets.chomp.chars
T = readlines.map(&:chomp).reverse

s = [-1, N]
T.each_with_index do |t,i|
  s[0] += 1 if t == "#{S[s[0]+1]} L"
  s[1] -= 1 if t == "#{S[s[1]-1]} R"
end

puts N-((s[0]+1)+N-s[1])