#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  int satan, utan;
  satan = 0;
  utan = n - 1;
  char t[q], d[q];
  for (int i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
  }
  for (int i = q - 1; i >= 0; i--) {
    satan = min(n - 1, max(0, satan));
    utan = min(n - 1, max(0, utan));
    if (s[satan] == t[i] && d[i] == 'L') {
      satan++;
    }
    if (satan != 0) {
      if (s[satan - 1] == t[i] && d[i] == 'R') {
        satan--;
      }
    }
    if (s[utan] == t[i] && d[i] == 'R') {
      utan--;
    }
    if (utan != n - 1) {
      if (s[utan + 1] == t[i] && d[i] == 'L') {
        utan++;
      }
    }
  }
  cout << 0 << endl;
  return 0;
  if (satan > utan) {
    cout << 0 << endl;
  } else {
    cout << utan - satan + 1 << endl;
  }
  return 0;
}
