#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  string s, t, d;
  cin >> n >> q >> s;
  t = string(q, 'A');
  d = string(q, 'R');
  for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
  int lft = 0, rit = n - 1;
  for (int i = q - 1; i >= 0; i--) {
    if (lft > rit) break;
    if (t[i] == s[lft] && d[i] == 'L') lft++;
    if (t[i] == s[rit] && d[i] == 'R') rit--;
  }
  cout << rit - lft + 1 << endl;
  return 0;
}
