#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<char> t(Q), d(Q);
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  int l = 0, r = N - 1;
  for (int i = Q - 1; i >= 0; i--) {
    if (l < N && t[i] == s[l] && d[i] == 'L') l++;
    if (r >= 0 && t[i] == s[r] && d[i] == 'R') r--;
  }
  ll ans = r >= l ? r - l + 1 : 0;
  cout << ans << '\n';
  return 0;
}
