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

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

qq.times do |n|
    inputs = (gets).split(" ")
    s = inputs[0]
    #command = inputs[1]
    p = 0
    i = 0
    #golems.each_with_index do |golem, ix|
    golems.map! do |golem|
        p = golem
        #i = ix
        #p0 = p
        #if (p >= 0 && names[p] == s) then
        if (p >= 0 && names[p] == inputs[0]) then
            #case command
            case inputs[1]
              when 'L'
                p = p - 1
              when 'R'
                p = p + 1
              else
                #ないはず
            end
         end
         if (p < 0 || p >= nn) then
             p = -1
         end
         #puts "#{p0} -> #{p}"
         golem = p
    end
    golems.delete(-1)
    #if (p >= 0) then
    #    golems[i] = p
    #else
    #    golems.delete_at(i)
    #end
    #p golems
end

#p golems

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