#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string s;
  int c = 0;
  cin >> N >> Q >> s;
  int firstC = 0, lastC = N - 1;
  char ii[Q][2];
  for (int i = 0; i < Q; i++) cin >> ii[i][0] >> ii[i][1];
  for (int i = Q - 1; i >= 0; --i)
    if (ii[i][0] == s[firstC] && ii[i][1] == 'L') {
      ++firstC;
      ++c;
    } else if (ii[i][0] == s[lastC] && ii[i][1] == 'R') {
      --lastC;
      ++c;
    }
  cout << (N - c) << endl;
  return 0;
}
