#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  s = "." + s + ".";
  string t(q, ' '), d(q, ' ');
  for (int i = 0; i < q; ++i) cin >> t[i] >> d[i];
  int l = 1;
  int r = n;
  for (int i = q - 1; i >= 0; --i) {
    if (d[i] == 'L' && s[l] == t[i])
      ++l;
    else if (d[i] == 'R' && s[r] == t[i])
      --r;
  }
  int ans = max(0, r - l + 1);
  cout << ans << endl;
  return 0;
}
