N, Q = gets.split(" ").map(&:to_i)
s = gets.chomp.split(//)

ts = []
ds = []
Q.times do
    t, d = gets.split(" ")
    ts << t
    ds << d
end
ixL = 0
ixR = N - 1
(0...Q).reverse_each do |ix|
    t = ts[ix]
    d = ds[ix]
    case d
    when 'L'
        ixL += 1 if t == s[ixL]
    when 'R'
        ixR -= 1 if t == s[ixR]
    end
end

ans = [ixR - ixL + 1, 0].max
puts ans
