#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, q;
  char s[200020], t[200020], d[200020];
  cin >> n >> q;
  cin >> s;
  for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
  int x = 0, y = n - 1, xt = 0, yt = 0;
  for (int i = q - 1; i >= 0; i--) {
    if (d[i] == 'L' && s[x] == t[i]) {
      if (xt == 0)
        x++;
      else
        xt--;
    }
    if (d[i] == 'R' && s[x] == t[i]) xt++;
    if (d[i] == 'R' && s[y] == t[i]) {
      if (yt == 0)
        y--;
      else
        yt--;
    }
    if (d[i] == 'L' && s[y] == t[i]) yt++;
  }
  cout << n - x - (n - 1 - y) << endl;
}
