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

golems = []
nn.times do |n|
    #golems.push({"name": names[n], "com": "", "pos": n})
    golems.push({"pos": n})
end

qq.times do |n|
    inputs = (gets).split(" ")
    s = inputs[0]
    command = inputs[1]
    golems.each do |golem|
        if (golem[:pos] >= 0 && names[golem[:pos]] == s) then
            case command
              when 'L'
                golem[:pos] = golem[:pos] - 1
              when 'R'
                golem[:pos] = golem[:pos] + 1
              else
                #ないはず
            end
         end
         if (golem[:pos] < 0 || golem[:pos] >= nn) then
             golem[:pos] = -1
         end
    end
    #p golems
end

#p golems

alive = 0
nn.times do |n|
    if golems[n][:pos] >= 0 then
        alive = alive + 1
    end
end
puts alive