datas = gets.split(" ").map{|nn|nn.to_i}
n = datas[0]
q = datas[1]

map_data = gets.chomp.split("")

spells = []
q.times do|pp|
  spells << gets.split(" ")
  if spells[pp][1] == "L"
    spells[pp][1] = -1
  else
    spells[pp][1] = 1
  end
end


golems = n
stop = false
mapsize = map_data.size


def center_min st,ed
  if (st+ed)%2 == 0
    return (st+ed)/2
  else
    return (st+ed-1)/2
  end
end
def center_max st,ed
  if (st+ed)%2 == 0
    return (st+ed)/2
  else
    return (st+ed-1)/2
  end
end

#二分探索のように
startind = 0
endind = mapsize-1
found = false
while true
  place = center_min(startind,endind)
  i = place
  spells.each do|spell|
    next if map_data[place] != spell[0]
    place += spell[1]
    if place < 0
      found = true
    end
  end
  if found
    startind = i
  else
    endind = i
  end
  if endind - startind < 2
    break
  end
end
[endind,startind].each do|place|
  i = place
  spells.each do|spell|
    next if map_data[place] != spell[0]
    place += spell[1]
    if place < 0
      golems -= (i + 1)
      stop = true
    end
  end
  break if stop
end
startind = 0
endind = mapsize-1
found = false
stop = false
while true
  place = center_min(startind,endind)
  i = place
  spells.each do|spell|
    next if map_data[place] != spell[0]
    place += spell[1]
    if place >= mapsize
      # 右から出られる
      found = true
    end
  end
  if found
    endind = i
  else
    startind = i
  end
  if endind - startind < 2
    break
  end
end
[endind,startind].each do|place|
  i = place
  spells.each do|spell|
    next if map_data[place] != spell[0]
    place += spell[1]
    if place >= mapsize
      # 右から出られる
      golems -= mapsize - i
      stop = true
    end
  end
  break if stop
end


puts golems.to_s