parseInt(x) = parse(Int,x)

parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    N,Q = readline() |> split |> parseMap
    s = readline()
    s = s[1:length(s)-1]
    order = []
    for i in 1:Q
       t,d = readline() |> split
       push!(order,[t[1],d[1]])
    end

    function judge(a,mode)
        now = a
        flag = true
        if mode=='L'
            for i in 1:Q
                if s[now]==order[i][1]
                    if order[i][2]=='L'
                        if now==1
                            flag = false
                            return flag
                        else
                            now-=1
                        end
                    else
                        if now==N
                            return flag
                        else
                            now+=1
                        end
                    end
                end
            end
        else
            for i in 1:Q
        		if s[now]==order[i][1]
                    if order[i][2]=='L'
                        if now==1
                            return flag
                        else
                            now-=1
                        end
                    else
                        if now==N
                            flag = false
                            return flag
                        else
                            now+=1
                        end
                    end
                end
            end
        end
        return true
    end
    
    function bisect(l,r,mode)
        if r-l==1
            if mode=='L'
                return r
            else
                return l
            end
        else
            x=Int(floor((l+r)/2))
            if judge(x,mode)
                if mode=='L'
                    return bisect(l,x,mode)
                else
                    return bisect(x,r,mode)
                end
            else
                if mode=='L'
                    return bisect(x,r,mode)
                else
                    return bisect(l,x,mode)
                end
            end
        end
    end

    if N==1
        if judge(1,'L') && judge(1,'R')
            println(1)
        else
            println(0)
        end
    else
        if judge(1,'R') && judge(N,'L')
      		if judge(N,'R')
        		R = N
      		else
        		R = bisect(1,N,'R')
      		end
      		if judge(1,'L')
        		L = 1
      		else
        		L = bisect(1,N,'L')
      		end
            println(R-L+1)
    	else
      		println(0)
    	end
    end
end

main()
