#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
long n, q;
string s;
char t[200000];
char d[200000];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> q;
  cin >> s;
  for (long i = 0; i < q; i++) {
    scanf("%s %s", &t[i], &d[i]);
  }
  long l = 0;
  long r = n - 1;
  long lcnt = 0;
  long rcnt = 0;
  for (long i = q - 1; i >= 0; i--) {
    if (t[i] == s[l] && d[i] == 'L') {
      lcnt++;
      l++;
    }
  }
  for (long i = q - 1; i >= 0; i--) {
    if (t[i] == s[r] && d[i] == 'R') {
      rcnt++;
      r--;
    }
  }
  printf("%ld\n", n - lcnt - rcnt);
  return 0;
}
