#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, q, head = 0, tail;
  string str;
  cin >> n >> q >> str;
  vector<char> t(q);
  vector<char> d(q);
  tail = n - 1;
  for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
  for (int i = q - 1; i >= 0; i--) {
    if (t[i] == str[head] && d[i] == 'L')
      head++;
    else if (t[i] == str[tail] && d[i] == 'R')
      tail--;
  }
  cout << tail - head + 1 << endl;
  return 0;
}
