#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const long long INF = LLONG_MAX;
signed main() {
  long long n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> t(q);
  vector<char> d(q);
  for (long long i = 0; i < q; i++) cin >> t[i] >> d[i];
  long long l = 0;
  long long r = n;
  for (long long i = q - 1; i >= 0; i--) {
    if (d[i] == 'R') {
      if (s[r - 1] == t[i]) r--;
    } else {
      if (s[l] == t[i]) l++;
    }
  }
  cout << max(0LL, r - l) << endl;
  return 0;
}
