#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  string s;
  set<int> a[26];
  vector<int> move(26, 0);
  cin >> n >> q >> s;
  for (int i = 0; i < n; i++) {
    a[s[i] - 'A'].insert(i);
  }
  vector<char> t(q), d(q);
  for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
  vector<bool> v(n, 0);
  int r = n, l = -1;
  for (int i = q - 1; i >= 0; i--) {
    if (l + 1 < n && t[i] == s[l + 1] && d[i] == 'L') {
      l++;
      v[l] = true;
    }
    if (r - 1 >= 0 && t[i] == s[r - 1] && d[i] == 'R') {
      r--;
      v[r] = true;
    }
  }
  int ans = n;
  for (int i = 0; i < n; i++)
    if (v[i]) ans--;
  cout << ans << endl;
  return 0;
}
