#include <bits/stdc++.h>
using namespace std;
int n, q, ans, u[1000005], ind;
char s[1000005], x[1000005], y[1000005];
int main() {
  scanf("%d %d %s", &n, &q, s + 1);
  for (int i = 1; i <= q; i++) scanf(" %c %c", x + i, y + i);
  ind = n + 1;
  u[0] = u[n + 1] = 1;
  for (int i = q; i >= 1; i--) {
    if (y[i] == 'R' and ind != 0)
      if (s[ind - 1] == x[i]) ind--;
    if (y[i] == 'L')
      if (s[ind + 1] == x[i]) ind++;
    if (!u[ind]) ans++;
    u[ind] = 1;
  }
  for (int i = 1; i <= n; i++) u[i] = 0;
  ind = 0;
  for (int i = q; i >= 1; i--) {
    if (y[i] == 'R' and ind != 0)
      if (s[ind - 1] == x[i]) ind--;
    if (y[i] == 'L')
      if (s[ind + 1] == x[i]) ind++;
    if (!u[ind]) ans++;
    u[ind] = 1;
  }
  printf("%d\n", n - ans);
  return 0;
}
