#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> t(q), d(q);
  for (int i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
  }
  int L = -1, R = n;
  for (int i = q - 1; i >= 0; i--) {
    if (d[i] == 'R') {
      if (R - 1 >= 0) {
        if (s[R - 1] == t[i]) {
          R--;
        }
      }
    } else {
      if (L + 1 < n) {
        if (s[L + 1] == t[i]) {
          L++;
        }
      }
    }
    if (L >= R) {
      break;
    }
  }
  int ans = (L + 1) + (n - R) - (L == R);
  ans = n - ans;
  cout << ans << endl;
  return 0;
}
