#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int i = 0, num, snum, l = 0, r;
  string s;
  cin >> num >> snum >> s;
  r = num - 1;
  vector<string> spl(snum), drct(snum);
  for (r = num - 1; i < snum; i++) cin >> spl[i] >> drct[i];
  for (i = snum - 1; i >= 0; i--) {
    if (s[l] == spl[i][0] && drct[i] == "L")
      l++;
    else if (s[r] == spl[i][0] && drct[i] == "R")
      r--;
  }
  cout << r - l + 1 << "\n";
  return 0;
}
