#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const long long mod = 1e9 + 7;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  s = '$' + s + '$';
  pair<int, char> p[q];
  for (int i = (int)(0); i < (int)(q); ++i) {
    char x, y;
    cin >> y >> x;
    p[i].first = (x == 'R');
    p[i].second = y;
  }
  reverse(p, p + q);
  int l = 0, r = n + 1;
  for (int i = (int)(0); i < (int)(q); ++i) {
    if (p[i].first) {
      if (s[r - 1] == p[i].second) --r;
    } else {
      if (s[l + 1] == p[i].second) ++l;
    }
  }
  cout << max(r - l - 1, 0) << endl;
  return 0;
}
