@n,@q = gets.split.map(&:to_i)
@s = gets
@q = (1..@q).map{gets.split}

def check(i)
    cur = i
    @q.each{|q|
        if (q[0] != @s[cur]) then
            next
        end
        if q[1] == 'L' then
            cur-=1
        else
            cur+=1
        end
        if cur == -1 || cur == @n then
            break
        end
    }
    return cur
end
dropped = ((0...@n).bsearch{|i| check(i) >=0} || @n)
dropped+= (@n - ((0...@n).bsearch{|i| check(i) == @n} || @n))
puts (@n- dropped)