#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  string r = "", l = "";
  for (long long int i = 0; i < q; ++i) {
    char t, d;
    cin >> t >> d;
    if (d == 'R') {
      r += t;
    } else {
      l = t + l;
    }
  }
  int d = 0;
  int id = 0;
  for (int i = 0; i < s.size(); i++) {
    while (id < l.size()) {
      if (s[i] == l[id]) {
        d++;
        id++;
        break;
      }
      id++;
    }
    if (id == l.size()) {
      break;
    }
  }
  id = r.size() - 1;
  for (int i = s.size() - 1; i >= 0; i--) {
    while (id >= 0) {
      if (s[i] == r[id]) {
        d++;
        id--;
        break;
      }
      id--;
    }
    if (id < 0) {
      break;
    }
  }
  cout << max(n - d, 0) << endl;
  return 0;
}
