#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q, ans = 0, tmp = 0, tp = 0, idx = 0;
  string s;
  char t[200010], d[200010], c;
  cin >> n >> q >> s;
  s += " ";
  for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
  for (int i = q - 1; i >= 0; i--) {
    if (d[i] == 'L') {
      if (s[idx] == t[i]) {
        tmp++;
        idx++;
      }
    } else {
      if (s[idx - 1] == t[i]) {
        tp = max(tp, tmp);
        tmp--;
        idx--;
      }
    }
  }
  ans += max(tp, tmp);
  idx = n - 1;
  tp = 0;
  tmp = 0;
  for (int i = q - 1; i >= 0; i--) {
    if (d[i] == 'R') {
      if (s[idx] == t[i]) {
        tmp++;
        idx--;
      }
    } else {
      if (s[idx + 1] == t[i]) {
        tmp--;
        idx++;
      }
    }
  }
  ans += max(tp, tmp);
  cout << n - ans << endl;
}
