#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  long long cnt[26] = {0};
  for (long long i = 0; i < S.size(); i++) {
    cnt[S[i] - 'A']++;
  }
  long long L = 0, R = N - 1;
  vector<char> a(Q), b(Q);
  for (long long i = 0; i < Q; i++) cin >> a[i] >> b[i];
  for (long long i = Q - 1; i >= 0; i--) {
    if (cnt[a[i] - 'A'] == 0) continue;
    if (b[i] == 'L' && S[L] == a[i]) {
      L++;
    }
    if (b[i] == 'R' && S[R] == a[i]) {
      R--;
    }
  }
  cout << N - L - (N - R) + 1 << endl;
  return 0;
}
