function Main(input) {
    const N = parseInt(input[0]);
    const Q = parseInt(input[1]);
    const S = input[2];
    const TD = input.slice(3);
    
    var start = 1;
    var end = N;
    for(var i = Q-1; i >= 0; i--) {
        const t = TD[i*2];
        const d = TD[i*2+1];
        if(t[d] == "R") {
            if(S[end - 1] == t){
                end--;
            }
        }else{
            if(S[start-1] == t){
                start++;
            }
        }
    }
    return end-start+1;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));