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