#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<pair<char, char>> query(Q);
  for (auto &&q : query) {
    cin >> q.first >> q.second;
  }
  reverse(query.begin(), query.end());
  int safeLeft = 0, safeRight = N - 1;
  for (auto q : query) {
    if (q.second == 'R') {
      if (q.first == s[safeRight]) {
        safeRight--;
      }
    }
    if (q.second == 'L') {
      if (q.first == s[safeLeft]) {
        safeLeft++;
      }
    }
  }
  cout << safeRight - safeLeft + 1 << endl;
  return 0;
}
