#include <bits/stdc++.h>
using namespace std;
int n, q, x[100005], y[100005];
char s[100005];
int main() {
  scanf("%d%d", &n, &q);
  scanf("%s", s + 1);
  for (int i = 1; i <= q; i++) {
    char a[5], b[5];
    scanf("%s%s", a, b);
    x[i] = a[0] - 'A';
    if (b[0] == 'R') y[i] = 1;
  }
  int l = 1, ans = n;
  for (int i = q; i >= 1; i--) {
    if (x[i] == s[l] - 'A' && y[i] == 0)
      l++, ans--;
    else if (l - 1 >= 1 && s[l - 1] - 'A' == x[i] && y[i] == 1)
      l--, ans++;
  }
  int r = n;
  for (int i = q; i >= 1; i--) {
    if (x[i] == s[r] - 'A' && y[i] == 1)
      r--, ans--;
    else if (r + 1 <= n && s[r + 1] - 'A' == x[i] && y[i] == 0)
      r++, ans++;
  }
  cout << max(0, r - l + 1) << endl;
}
