#include <bits/stdc++.h>
using namespace std;
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];
  }
  deque<char> deq(s.begin(), s.end());
  for (int i = q - 1; i >= 0; i--) {
    if (d[i] == 'L') {
      if (deq.front() == t[i]) {
        deq.pop_front();
      }
    } else if (d[i] == 'R') {
      if (deq.back() == t[i]) {
        deq.pop_back();
      }
    }
    if (deq.empty()) {
      break;
    }
  }
  int ans = deq.size();
  cout << ans << endl;
  return 0;
}
