#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<char> t(Q), d(Q);
  for (int i = Q - 1; i >= 0; i--) {
    cin >> t[i] >> d[i];
  }
  int li, ri;
  li = 0;
  ri = N - 1;
  for (int i = 0; i < Q; i++) {
    if (s[li] == t[i] && d[i] == 'L') li++;
    if (s[ri] == t[i] && d[i] == 'R') ri--;
  }
  cout << ri - li + 1 << endl;
  return 0;
}
