#include <bits/stdc++.h>
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  int kazu[200001] = {1};
  char s[200001] = {'0'};
  char t[200001] = {'0'};
  char d[200001] = {'0'};
  scanf("%s", s);
  for (int i = 0; i < q; i++) {
    scanf("%s%s", &t[i], &d[i]);
  }
  int count = 0;
  for (int i = q - 1; i >= 0; i--) {
    if (d[i] == 'L') {
      if (s[count] == t[i]) {
        count++;
      }
    }
  }
  int count2 = 0;
  for (int i = q - 1; i >= 0; i--) {
    if (d[i] == 'R') {
      if (s[n - 1 - count2] == t[i]) {
        count2++;
      }
    }
  }
  printf("%d\n", n - count - count2);
  return 0;
}
