#include <bits/stdc++.h>
using namespace std;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
constexpr long long TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T, class U>
void chmin(T& t, const U& u) {
  if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
  if (t < u) t = u;
}
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;
}
int main() {
  int N, Q;
  string in;
  V<int> s;
  cin >> N >> Q >> in;
  for (int i = 0; i < (N); i++) s.push_back(in[i] - 'A');
  V<int> C(Q), D(Q);
  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] && D[i] == 0) {
      ++l;
    } else if (l > 0 && C[i] == s[l - 1] && D[i] == 1) {
      --l;
    }
    if (C[i] == s[r] && D[i] == 1) {
      --r;
    } else if (r + 1 < N && C[i] == s[r - 1] && D[i] == 0) {
      ++r;
    }
    chmin(r, N - 1);
    chmax(l, 0);
    if (l > r) {
      puts("0");
      return 0;
    }
  }
  cout << max(r - l + 1, 0) << endl;
  return 0;
}
