#include <bits/stdc++.h>
using namespace std;
const double pi =
    3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod = 1000000007;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> cc, dd;
  int l = 0, r = n - 1;
  for (int i = (0); i < (q); ++i) {
    string t, d;
    cin >> t >> d;
    int dd2 = -1;
    char c = t[0];
    if (d[0] == 'R') dd2 = 1;
    cc.push_back(c);
    dd.push_back(dd2);
  }
  for (int i = (q)-1; i >= (0); --i) {
    if (l > r) break;
    if (cc[i] == s[r]) {
      if (dd[i] == 1) {
        r--;
      }
    }
    if (cc[i] == s[l]) {
      if (dd[i] == -1) {
        l++;
      }
    }
  }
  if (l > r)
    cout << 0 << endl;
  else
    cout << r - l + 1 << endl;
  return 0;
}
