#include <bits/stdc++.h>
using namespace std;
long long n, q, l, r;
string s;
char t[200010], d[200010];
int main(void) {
  cin >> n >> q >> s;
  s = " " + s;
  for (int i = 0; i < ((int)(q)); i++) cin >> t[i] >> d[i];
  l = 1;
  r = n;
  for (int i = ((int)(q)-1); i >= 0; i--) {
    if (t[i] == s[l] && d[i] == 'L') l++;
    if (t[i] == s[r] && d[i] == 'R') r--;
  }
  cout << max((long long)0, r - l + 1) << endl;
  return 0;
}
