#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> t(n), d(n);
  for (long long int i = 0; i < q; i++) cin >> t[i] >> d[i];
  long long int left = 0;
  long long int right = n - 1;
  for (long long int i = q - 1; i >= 0; i--) {
    if (left >= n) break;
    char nowPos = s[left];
    if (0)
      cout << "nowPos=" << nowPos << " t[i]=" << t[i] << " d[i]=" << d[i]
           << endl;
    if (t[i] == nowPos && d[i] == 'L') left++;
  }
  for (long long int i = q - 1; i >= 0; i--) {
    if (right < 0) break;
    char nowPos = s[right];
    if (0)
      cout << "nowPos=" << nowPos << " t[i]=" << t[i] << " d[i]=" << d[i]
           << endl;
    if (t[i] == nowPos && d[i] == 'R') right--;
  }
  if (0) cout << "left=" << left << " right=" << right << endl;
  cout << max(0LL, right - left + 1) << endl;
  return 0;
}
