#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, Q, i;
  string S;
  cin >> N >> Q;
  cin >> S;
  string t[Q], d[Q];
  for (i = 0; i < Q; i++) cin >> t[i] >> d[i];
  int left = 0;
  int right = N - 1;
  for (i = Q - 1; i >= 0; i--) {
    if ((t[i] == S.substr(left, 1)) & (d[i] == "L")) left++;
    if ((t[i] == S.substr(right, 1)) & (d[i] == "R")) right--;
  }
  cout << right - left + 1 << endl;
  return 0;
}
