"use strict";

// read lines from stdin
const input = require("fs")
  .readFileSync("/dev/stdin", "utf8")
  .split("\n");

const firstLine = input[0].split(" ").map((val) => parseInt(val, 10));
const N = firstLine[0];
const Q = firstLine[1];

const S = input[1];
const golems = new Array(N).fill(1);

let left = 0;
let right = N - 1;

for (let i = Q + 1; i > 1; i--) {
  const spell = input[i].split(" ");
  const t = spell[0];
  const d = spell[1];

  if (S.charAt(left) === t && d === "L") {
    left++;
  } else if (S.charAt(right) === t && d === "R") {
    right--;
  }
}

console.log(left <= right ? N - (left + (N - 1 - right)) : 0);
