#include <bits/stdc++.h>
typedef struct {
  char t, d;
} Query;
long long n, q;
char grid[200005];
Query query[200005];
long long simulate(long long position);
long long bin_search(char mode);
long long input(const char* format, ...);
int main() {
  input("%lld %lld", &n, &q);
  input("%s", grid + 1);
  for (long long i = 0; i < q; i++) {
    input("%c %c", &query[i].t, &query[i].d);
  }
  printf("%lld\n", bin_search('R') - bin_search('L') + 1);
  return EXIT_SUCCESS;
}
long long simulate(long long position) {
  long long i = 0;
  while (i < q && position >= 1 && position <= n) {
    if (query[i].t == grid[position]) {
      if (query[i].d == 'L') {
        position--;
      } else if (query[i].d == 'R') {
        position++;
      }
    }
    i++;
  }
  return position;
}
long long bin_search(char mode) {
  long long valid, invalid;
  long long mid;
  if (mode == 'L') {
    valid = 1;
    while (simulate(valid) < 1) {
      valid++;
    }
  } else if (mode == 'R') {
    valid = n;
    while (simulate(valid) > n) {
      valid--;
    }
  }
  return valid;
}
long long input(const char* format, ...) {
  va_list args;
  char buff[BUFSIZ];
  long long ret_val;
  fgets(buff, sizeof(buff) - 1, stdin);
  va_start(args, format);
  ret_val = vsscanf(buff, format, args);
  va_end(args);
  return ret_val;
}
