#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, q;
  char s[200020], t[200020], d[200020];
  cin >> n >> q;
  cin >> s;
  for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
  int x = 0, y = n - 1;
  for (int i = q - 1; i >= 0; i--) {
    if (d[i] == 'L') {
      if (s[x] == t[i]) x++;
    }
    if (d[i] == 'R') {
      if (s[y] == t[i]) y--;
    }
  }
  cout << n - x - (n - 1 - y) << endl;
}
