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