#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> t(q);
  vector<char> d(q);
  for (int i = 0; i < q; ++i) {
    cin >> t[i] >> d[i];
  }
  reverse(t.begin(), t.end());
  reverse(d.begin(), d.end());
  int right_limit = -1;
  int left_limit = n;
  for (int i = 0; i < (int)t.size(); ++i) {
    if (right_limit >= n - 1) {
      break;
    }
    if (left_limit < 0) {
      break;
    }
    if (left_limit <= right_limit) {
      break;
    }
    if (d[i] == 'L') {
      if (s[right_limit + 1] == t[i]) {
        ++right_limit;
      }
    }
    if (d[i] == 'R') {
      if (s[left_limit - 1] == t[i]) {
        --left_limit;
      }
    }
  }
  int alive = left_limit - right_limit - 1;
  alive = max(alive, 0);
  cout << alive << endl;
  return 0;
}
