#include <bits/stdc++.h>
using namespace std;
int N, Q;
int main() {
  cin >> N >> Q;
  vector<int> S(N);
  char C;
  for (int i = 0; i < N; i++) {
    cin >> C;
    S[i] = C - 'A';
  }
  vector<int> T(Q), D(Q);
  char t, d;
  for (int i = 0; i < Q; i++) {
    cin >> t >> d;
    T[i] = t - 'A';
    if (d == 'R') {
      D[i] = 1;
    } else {
      D[i] = -1;
    }
  }
  int Lidx = 0, Ridx = N - 1;
  for (int i = Q - 1; i >= 0; i--) {
    if (T[i] == S[Lidx] and D[i] == -1) {
      Lidx++;
    }
    if (T[i] == S[Ridx] and D[i] == 1) {
      Ridx--;
    }
  }
  int ans;
  if (Lidx > Ridx) {
    ans = 0;
  } else {
    ans = Ridx - Lidx + 1;
  }
  cout << ans << endl;
  return 0;
}
