#include <bits/stdc++.h>
using namespace std;
template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& x : vec) {
    is >> x;
  }
  return is;
}
int main() {
  long long ans = 0;
  long long tmp;
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  s = "*" + s + "*";
  vector<char> t(q), d(q);
  for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
  int fr = n + 1, fl = 0;
  for (int i = q - 1; i >= 0; i--) {
    if (d[i] == 'R' && s[fr - 1] == t[i]) fr--;
    if (d[i] == 'L' && s[fl + 1] == t[i]) fl++;
  }
  cout << max(fr - fl - 1, 0) << endl;
}
