#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> t(Q), d(Q);
  for (int i = 0; i < (int)(Q); i++) cin >> t[i] >> d[i];
  vector<int> se(N);
  for (int i = 0; i < (int)(N); i++) se[i] = -1;
  vector<int> flag(N);
  int num1 = -1, num2 = N;
  for (int i = 0; i < (int)(Q); i++) {
    if (num1 + 1 < N && t[Q - 1 - i] == s[num1 + 1] && d[Q - 1 - i] == 'L') {
      se[num1 + 1] = Q - 1 - i;
      num1++;
    }
    if (num2 - 1 > -1 && t[Q - 1 - i] == s[num2 - 1] && d[Q - 1 - i] == 'R') {
      se[num2 - 1] = Q - 1 - i;
      num2--;
    }
  }
  int cnt = 0;
  for (int i = 0; i < (int)(N); i++) {
    if (se[i] != -1) cnt++;
  }
  cout << N - cnt << endl;
  return 0;
}
