#include <bits/stdc++.h>
typedef struct Query {
  char mcChar;
  char mcLR;
} Query;
static FILE *szpFpI;
static char sc1Mass[200005];
static int siMCnt;
static Query sz1Query[200005];
static int siQCnt;
int fOutLine(char *pcpLine) {
  char lc1Buf[1024];
  printf("%s", pcpLine);
  return 0;
}
int fMain() {
  int i;
  char lc1Buf[1024];
  fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
  sscanf(lc1Buf, "%d%d", &siMCnt, &siQCnt);
  fgets(sc1Mass, sizeof(sc1Mass), szpFpI);
  for (i = 0; i < siQCnt; i++) {
    fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
    sscanf(lc1Buf, "%c %c", &sz1Query[i].mcChar, &sz1Query[i].mcLR);
  }
  int liLNo = 0;
  int liRNo = siMCnt - 1;
  for (i = siQCnt - 1; i >= 0; i--) {
    if (sz1Query[i].mcLR == 'L') {
      if (sz1Query[i].mcChar == sc1Mass[liLNo]) {
        liLNo++;
      }
    } else {
      if (sz1Query[i].mcChar == sc1Mass[liRNo]) {
        liRNo--;
      }
    }
  }
  return liRNo - liLNo + 1;
}
int fOne() {
  int liRet;
  char lc1Buf[1024];
  szpFpI = stdin;
  liRet = fMain();
  sprintf(lc1Buf, "%d\n", liRet);
  fOutLine(lc1Buf);
  return 0;
}
int main() {
  fOne();
  return 0;
}
