#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s, rs;
  cin >> s;
  rs = s;
  reverse((rs).begin(), (rs).end());
  vector<char> t(Q), d(Q);
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  int cur = 0;
  vector<int> rused(N, -1);
  for (int i = Q - 1; i >= 0; i--) {
    if (cur == N) break;
    if (t[i] == rs[cur] and d[i] == 'R') {
      rused[cur] = i;
      cur++;
    }
  }
  cur = 0;
  vector<int> lused(N, -1);
  for (int i = Q - 1; i >= 0; i--) {
    if (cur == N) break;
    if (t[i] == s[cur] and d[i] == 'L') {
      lused[cur] = i;
      cur++;
    }
  }
  int ans = N;
  for (int i = 0; i < N; i++) {
    if (rused[i] == -1) break;
    ans--;
  }
  for (int i = 0; i < N; i++) {
    if (lused[i] == -1) break;
    ans--;
  }
  cout << max(ans, 0) << endl;
  return 0;
}
