#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  string s;
  cin >> s;
  char ch, dir;
  vector<pair<char, int>> spell;
  queue<pair<int, int>> seq;
  set<pair<int, int>> mp;
  getchar();
  for (int i = 0; i < q; i++) {
    scanf("%c %c\n", &ch, &dir);
    spell.push_back(make_pair(ch, dir));
    if (ch == s[0] && dir == 'L') {
      seq.push(make_pair(0, i - 1));
      mp.insert(seq.front());
    }
    if (ch == s.back() && dir == 'R') {
      seq.push(make_pair(n - 1, i - 1));
      mp.insert(seq.front());
    }
  }
  int head = 0;
  for (int i = q - 1; head < n && i >= 0; i--) {
    if (spell[i].first == s[head] && spell[i].second == 'L') {
      head++;
    }
  }
  int tail = n - 1;
  for (int i = q - 1; tail >= 0 && i >= 0; i--) {
    if (spell[i].first == s[tail] && spell[i].second == 'R') {
      tail--;
    }
  }
  if (head > tail) {
    cout << 0 << endl;
  } else {
    cout << tail - head + 1 << endl;
  }
  return 0;
}
