#include <bits/stdc++.h>
typedef struct {
  char t, d;
} Query;
int n, q;
char grid[200005];
Query query[200005];
int simulation(char mode);
int main() {
  int left_fall, right_fall;
  scanf("%d %d", &n, &q);
  scanf("%s", grid + 1);
  for (int i = 0; i < q; i++) {
    scanf(" %c %c", &query[i].t, &query[i].d);
  }
  left_fall = simulation('L');
  right_fall = simulation('R');
  printf("%d\n", right_fall - left_fall - 1);
  return 0;
}
int simulation(char mode) {
  int i = q - 1;
  int position = (mode == 'L' ? 0 : n + 1);
  while (i >= 0) {
    if (query[i].d == 'L' && query[i].t == grid[position + 1] && mode == 'L') {
      position++;
    } else if (query[i].d == 'R' && position > 0 &&
               query[i].t == grid[position - 1] && mode == 'R') {
      position--;
    }
    i--;
  }
  return position;
}
