#include <bits/stdc++.h>
using namespace std;
const int Qmax = 2e5;
int N, Q;
string S;
char T[Qmax], D[Qmax];
int main() {
  cin >> N >> Q;
  cin >> S;
  for (int i = 0; i < Q; i++) cin >> T[i] >> D[i];
  int l = 0, r = N - 1;
  for (int i = Q - 1; i >= 0; i--) {
    if (S[l] == T[i] && D[i] == 'L') l++;
    if (S[r] == T[i] && D[i] == 'R') r--;
  }
  cout << r - l + 1 << endl;
  return 0;
}
