#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;
int N, Q;
string s;
vector<pair<char, bool>> td;
int main() {
  cin >> N >> Q >> s;
  for (ll((i)) = (0); ((i)) < ((Q)); ((i))++) {
    string tmp1;
    string tmp2;
    cin >> tmp1 >> tmp2;
    td.push_back({tmp1[0], tmp2 == "R"});
  }
  reverse(td.begin(), td.end());
  int posl = -1;
  int deadlbg = -2;
  int posr = N;
  int deadrbg = -2;
  for (auto p : td) {
    if (posr == 0) break;
    if (p.second == true) {
      if (p.first == s[posr - 1]) {
        posr--;
        deadrbg = -2;
      }
    } else {
      if (deadrbg == -2) {
        if (posr < N && p.first == s[posr]) {
          deadrbg = posr + 1;
        }
      } else {
        if (deadrbg == N) continue;
        if (p.first == s[deadrbg]) deadrbg++;
      }
    }
  }
  for (auto p : td) {
    if (posl == N - 1) break;
    if (p.second == false) {
      if (p.first == s[posl + 1]) {
        posl++;
        deadlbg = -2;
      }
    } else {
      if (deadlbg == -2) {
        if (posl >= 0 && p.first == s[posl]) {
          deadlbg = posl - 1;
        }
      } else {
        if (deadlbg == -1) continue;
        if (p.first == s[deadlbg]) deadlbg--;
      }
    }
  }
  ll res = 0;
  if (deadlbg == -2)
    res += posl + 1;
  else
    res += deadlbg + 1;
  if (deadrbg == -2)
    res += (N - posr);
  else
    res += (N - deadrbg);
  res = N - res;
  res = max(res, 0ll);
  cout << res << endl;
  return 0;
}
