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 = true
    if inputs[1] == 'R' then
       d = false
    end
    $commands.push({"target": inputs[0], "direct": d})
end

# ゴーレムを端から調べると死ぬ
# ゴーレムが重なることはあってもすれちがうことはないので、真ん中のやつから調べればいい
def get_dead_pos(lef0, rht0, nn0, isLeftS)
    lef = lef0
    rht = rht0
    cen = (rht+lef)/2
    isAlive = true
    while true
          isFinal = false
          golem = 0
          #puts "#{lef} | #{cen} | #{rht}"
          $commands.each_with_index do |cmd, cnt|
            s = cmd[:target]
            direct = cmd[:direct]
            isFinal = (cnt == ($commands.length-1))
            #$golems.map! do |golem|
            golem = $golems[cen]
                p = golem
                #puts $names[p]
                if (p >= 0 && $names[p] == s) then
                    if direct then
                        p = p - 1
                    else
                        p = p + 1
                    end
                end
                #puts p
                golem = p
                $golems[cen] = golem
                if (p < lef0 || p > rht0) then
                    break
                end
            #end
          end
          if not isLeftS then
              if (nn0 <= golem) then # 死んだ
                 isAlive = false
                 if isFinal then # ちょうど死んだ
                   break
                 else
                   # いきてるやつを探す
                   rht = cen
                   cen = (lef+cen)/2
                   break if (rht==cen) # 計算が収束している
                 end
              else
                lef = cen
                cen = (rht+cen)/2
                break if (lef==cen) # 計算が収束している
              end
          else
              #puts golem
              if (0 > golem) then # 死んだ
                 isAlive = false
                 if isFinal then # ちょうど死んだ
                   break
                 else
                   lef = cen
                   cen = (rht+cen)/2
                   break if (lef==cen) # 計算が収束している
                 end
              else
                rht = cen
                cen = (lef+cen)/2
                break if (rht==cen) # 計算が収束している
              end
          end
    end
    #puts "return: #{cen} #{isAlive}"
    return cen,isAlive
end # function

cen1 = 0
cen2 = nn-1
dead = 0
case nn
  when 1
    cen1,f = get_dead_pos(0,0,nn, true)
    dead = 1 if not f
  when 2
    cen1,f = get_dead_pos(0,0,nn,true)
    dead = dead + 1 if not f
    cen2,f = get_dead_pos(1,1,nn,false)
    dead = dead + 1 if not f
  else
    cen1,f = get_dead_pos(0, nn.div(2), nn, true)
    if f then
        dead = cen1
    else
        dead = cen1 + 1
    end
    cen2,f = get_dead_pos(nn.div(2)+1, nn-1, nn, false)
    if f then
        dead = dead + ( (nn-1)-cen2 )
    else
        dead = dead + ( (nn-1)-cen2+1 )
    end
end

puts nn-dead