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