#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  char s[200010];
  int si[200010];
  pair<int, int> query[200010];
  scanf("%d%d", &n, &q);
  scanf("%s", s);
  for (int i = 0; i < n; i++) si[i] = s[i] - 'A';
  for (int i = 0; i < q; i++) {
    char t, d;
    scanf(" %c %c", &t, &d);
    query[i] = {t - 'A', d == 'L'};
  }
  reverse(query, query + q);
  int L = -1, R = n;
  for (int i = 0; i < q; i++) {
    int t = query[i].first;
    int d = query[i].second;
    if (d == 0) {
      if (R > 0 && si[R - 1] == t) {
        R--;
      }
      if (L > 0 && si[L - 1] == t) {
      }
    } else {
      if (R < n - 1 && si[R + 1] == t) {
      }
      if (L < n - 1 && si[L + 1] == t) {
        L++;
      }
    };
    ;
    ;
    ;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += i <= L || R <= i;
  }
  cout << n - ans << endl;
  return 0;
}
