#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, Q;
  string s;
  scanf("%lld", &N);
  scanf("%lld", &Q);
  cin >> s;
  vector<char> t(Q), d(Q);
  for (int i = 0; i < Q; i++) {
    cin >> t[i];
    cin >> d[i];
  }
  long long res = 0, l = 0, r = N - 1, ln = 1, rn = 1;
  for (int i = Q - 1; i >= 0; i--) {
    if (t[i] == s[l] && d[i] == 'L') {
      res += ln;
      ln = 1;
      l++;
    }
    if (t[i] == s[r] && d[i] == 'R') {
      res += rn;
      rn = 1;
      r--;
    }
  }
  cout << N - res << endl;
  return 0;
}
