#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q, p1, p2;
  char s[200010], d[200000][3], t[200000][3];
  scanf("%d %d", &n, &q);
  scanf("%s", s);
  for (int i = 0; i < q; i++) {
    scanf("%s %s", t[i], d[i]);
  }
  p1 = -1;
  p2 = n;
  for (int i = q - 1; i >= 0; i--) {
    if (d[i][0] == 'R' && p2 > 0 && s[p2 - 1] == t[i][0]) {
      p2--;
    }
    if (d[i][0] == 'L' && p1 < n - 1 && s[p1 + 1] == t[i][0]) {
      p1++;
    }
  }
  if (p1 >= p2) {
    printf("0\n");
  } else {
    printf("%d\n", n - (p1 + 1) - (n - p2));
  }
}
