#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> T(Q);
  vector<int> D(Q);
  char c;
  for (int i = 0; i < Q; i++) {
    cin >> T[i] >> c;
    if (c == 'L') {
      D[i] = 0;
    } else {
      D[i] = 1;
    }
  }
  int l = 0;
  int r = N + 1;
  for (int i = Q - 1; i >= 0; i--) {
    if (D[i] == 0) {
      if (s[l + 1 - 1] == T[i]) {
        l++;
      }
      if (r <= N) {
        if (s[r - 1] == T[i]) {
          r++;
        }
      }
    } else {
      if (s[r - 1 - 1] == T[i]) {
        r--;
      }
    }
    if (l >= r) break;
  }
  int res = N - l - (N + 1 - r);
  res = max((int)0, res);
  cout << res << endl;
}
