#include <bits/stdc++.h>
using namespace std;
void solve(void) {
  int n, q, ans, as[200020], ds[200020];
  string s;
  cin >> n >> q >> s;
  for (int i = 0; i < q; i++) {
    char a, d;
    cin >> a >> d;
    as[i] = a - 'A';
    ds[i] = d == 'R' ? 1 : -1;
  }
  vector<int> ok(n);
  int pos = -1;
  for (int i = q - 1; i >= 0; i--) {
    if (as[i] == s[pos + 1] - 'A' && ds[i] == -1) {
      pos++;
      ok[pos] = 1;
    }
    if (pos >= n - 1) break;
  }
  pos = n;
  for (int i = q - 1; i >= 0; i--) {
    if (as[i] == s[pos - 1] - 'A' && ds[i] == 1) {
      pos--;
      ok[pos] = 1;
    }
    if (pos < 0) break;
  }
  ans = n;
  for (int i = 0; i < n; i++) {
    ans -= ok[i];
  }
  cout << ans << endl;
}
int main(void) {
  solve();
  return 0;
}
