N, Q = gets.split.map(&:to_i)
@S = gets.chomp

@moves = []
Q.times do
  t, d = gets.split
  @moves << [t, d]
end

def simulate(start)
  current = start
  @moves.each do |t, d|
    next if t != @S[current]
    if d == 'R'
      if current == N-1
        return 1
      else
        current += 1
      end
    else
      if current == 0
        return -1
      else
        current -= 1
      end
    end
  end

  return 0
end

res = N

left = 0
current = N/2
right = N-1

if simulate(0) == -1
  loop do
    if simulate(current) == -1
      left = current
      current = (left+right)/2

      break if current == right
    else
      right = current
      current = (left+right)/2
      if current == left
        current -= 1
        break
      end
    end
  end
  res -= current+1
end


left = 0
current = N/2
right = N-1

if simulate(N-1) == 1
  loop do
    if simulate(current) == 1
      right = current
      current = (left+right)/2
      break current == left
    else
      left = current
      current = (left+right)/2
      if current == right
        current += 1
        break
      end
    end
  end

  res -= N-current
end

puts res
