#include <bits/stdc++.h>
using namespace std;
constexpr long long TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  for (int i = 0; i < (v.size()); i++) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}
const int MX = 200010;
int N, Q;
string S;
vector<int> s;
int C[MX], D[MX];
int main() {
  cin >> N >> Q;
  cin >> S;
  for (int i = 0; i < (N); i++) s.push_back(S[i] - 'A');
  for (int i = 0; i < (Q); i++) {
    string u, v;
    cin >> u >> v;
    C[i] = (u[0] - 'A');
    D[i] = (v[0] == 'R');
  }
  int l = 0, r = N - 1;
  for (int i = Q - 1; i >= 0; --i) {
    if (C[i] == s[l]) {
      if (D[i] == 0) {
        ++l;
      } else {
        if (l > 0 && S[l - 1] == C[i]) {
          --l;
        }
      }
    }
    if (C[i] == s[r]) {
      if (D[i] == 1) {
        --r;
      } else {
        if (r < N - 1 && S[r + 1] == C[i]) {
          ++r;
        }
      }
    }
    if (l > r) {
      puts("0");
      return 0;
    }
    l = min(l, N - 1);
    l = max(0, l);
    r = max(0, r);
    r = min(r, N - 1);
  }
  cout << max(r - l + 1, 0) << endl;
  return 0;
}
