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