#include <bits/stdc++.h>
int main(void) {
  int N, Q;
  scanf("%d%d", &N, &Q);
  char S[N];
  char D[Q][2];
  char T[Q][2];
  scanf("%s", S);
  int i, j;
  for (i = 0; i < Q; i++) {
    scanf("%s", T[i]);
    scanf("%s", D[i]);
  }
  int l = 0;
  int r = 0;
  int count = N - 1;
  for (i = Q - 1; i >= 0; i--) {
    if (D[i][0] == 'R' && T[i][0] == S[count]) {
      r = r + 1;
      count = count - 1;
    }
    if (count == 0) {
      break;
    }
  }
  count = 0;
  for (i = Q - 1; i >= 0; i--) {
    if (D[i][0] == 'L' && T[i][0] == S[count]) {
      l = l + 1;
      count = count + 1;
    }
    if (count == N - 1) {
      break;
    }
  }
  printf("%d\n", N - l - r);
  return 0;
}
