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