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