N, Q = gets.split.map(&:to_i)
S = gets.chomp.chars
M = ['l'] + S + ['r']
QUERIES = Q.times.map { gets.chomp.split }

def f(x, pos)
  cur = x
  ch = M[cur]

  return true if x == pos

  QUERIES.each do |t, d|
    next if t != ch

    if d == 'L'
      cur -= 1
    else
      cur += 1
    end

    ch = M[cur]

    return true if ch == pos
    return false if ch == 'l' || ch == 'r'
  end

  false
end

ok = 0
ng = N + 1

while (ok - ng).abs > 1
  mid = (ok + ng) / 2

  if f(mid, 'l')
    ok = mid
  else
    ng = mid
  end
end

left = ng

ok = N + 1
ng = 0

while (ok - ng).abs > 1
  mid = (ok + ng) / 2

  if f(mid, 'r')
    ok = mid
  else
    ng = mid
  end
end

right = ng

puts [right - left + 1, 0].max
