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