#include <bits/stdc++.h>
using namespace std;
ifstream fin("p.in");
ofstream fout("p.out");
int n, q;
char s[200001];
struct query {
  char pos;
  char dir;
};
query vec_q[200001];
int verif(int val) {
  char square = s[val - 1];
  for (int i = 1; i <= q; i++) {
    if (vec_q[i].pos == square) {
      fout << square << " ";
      if (vec_q[i].dir == 'L')
        val--;
      else
        val++;
      if (val > n)
        return n + 1;
      else if (val < 0)
        return n + 2;
      square = s[val - 1];
    }
  }
  return 1;
}
int best_left_out_right() {
  int st = 1;
  int dr = n;
  int sol;
  while (st <= dr) {
    int mij = (st + dr) / 2;
    if (verif(mij) == 0) {
      sol = mij;
    }
    dr = mij - 1;
  }
  return sol;
}
int best_right_out_left(int val) {
  int st = 1;
  int dr = val;
  int sol;
  while (st <= dr) {
    int mij = (st + dr) / 2;
    if (verif(mij) == 0) {
      sol = mij;
    }
    st = mij + 1;
  }
  return sol;
}
int main() {
  fin >> n >> q;
  fin >> s;
  for (int i = 1; i <= q; i++) {
    fin >> vec_q[i].pos >> vec_q[i].dir;
  }
  int val_1 = best_left_out_right();
  if (val_1 > n || val_1 < 0) val_1 = n + 1;
  int val_2 = best_right_out_left(val_1);
  cout << n - val_2 - (n - val_1 + 1);
  return 0;
}
