#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  int l = 0;
  int r = N - 1;
  char t[Q];
  char d[Q];
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  for (int i = Q - 1; i >= 0; i--) {
    if (d[i] == 'L') {
      if (t[i] == s[l]) {
        l++;
      }
    } else {
      if (t[i] == s[r]) {
        r--;
      }
    }
  }
  if (r == 0 || l == N - 1) {
    cout << N << endl;
  } else {
    cout << r - l + 1 << endl;
  }
}
