nq = (gets).split(" ")
nn = nq[0].to_i
qq = nq[1].to_i
$names = gets

$golems = (0..nn).to_a
$commands = []
qq.times do |n|
    inputs = (gets).split(" ")
    d = -1
    if inputs[1] == 'R' then
       d = 1
    end
    $commands.push({"target": inputs[0], "direct": d})
end

# とりあえずゴーレムを動かす関数を作りましょう
def operate_golem(target, limit)
    #puts "---- #{target}"
    cen = target
    #golem = 0
    golem = $golems[cen]
    #while true
        isFinal = false
        #puts "#{lef} | #{cen} | #{rht}"
        $commands.each_with_index do |cmd, cnt|
            s = cmd[:target]
            direct = cmd[:direct]
            p = golem
            #puts $names[p]
            if ($names[p] == s) then
                p = p + direct
            end
            #puts p
            golem = p
            #$golems[cen] = golem
            if (p < 0 || p > limit) then
                break
            end
        end #commands
    #end
return golem
end # function

# 二分探索せよとのことで、rubyには便利な関数があるので使う
def judge_alive(target, limit)
    p = operate_golem(target, limit)
    return (0 <= p && p <= limit)
end
left_alive = (0..(nn-1)).bsearch{|n| judge_alive(n, nn-1) }
#puts left_alive
alives = 0
if left_alive.nil? then #全滅
    alives = 0
else
    rigt_alive = ((left_alive+1)..(nn-1)).bsearch{|n| not judge_alive(n, nn-1) }
    #puts rigt_alive
    if rigt_alive.nil? then #それ以上だれもしななかったんだと思う
        rigt_alive = nn
    end
    alives = rigt_alive - left_alive
end

puts alives