#include <bits/stdc++.h>
using namespace std;
int n, q;
string s;
vector<pair<char, bool> > a;
int main() {
  cin >> n >> q >> s;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    a.push_back(make_pair(t, d == 'R'));
  }
  int L = 0;
  for (int i = q; L < n && i--;) {
    if (a[i].second) {
      if (L > 0 && a[i].first == s[L - 1]) {
        L--;
        break;
      }
    } else {
      if (a[i].first == s[L]) L++;
    }
  }
  L--;
  int R = n - 1;
  for (int i = q; R >= 0 && i--;) {
    if (a[i].second) {
      if (a[i].first == s[R]) R--;
    } else {
      if (R < n - 1 && a[i].first == s[R + 1]) {
        R++;
        break;
      }
    }
  }
  R++;
  cout << max(0, n - L - 1 - (n - R)) << endl;
}
