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