#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> j(N);
  vector<char> LR(Q);
  vector<bool> ans1(N, false);
  vector<bool> ans2(N, false);
  for (int i = 0; i < Q; i++) {
    cin >> j[i] >> LR[i];
  }
  char mL = s[0], mR = s[N - 1];
  int lp = 0, rp = N - 1;
  for (int i = Q - 1; i >= 0; i--) {
    if (LR[i] == 'L') {
      if (lp < N && lp >= 0 && j[i] == s[lp]) {
        if (lp < N) ans1[lp] = true;
        lp++;
      }
      if (rp < N - 1 && rp >= 0 && j[i] == s[rp + 1]) {
        if (rp < N) ans2[rp + 1] = false;
        rp++;
      }
    }
    if (LR[i] == 'R') {
      if (rp < N && rp >= 0 && j[i] == s[rp]) {
        if (rp > -1) ans2[rp] = true;
        rp--;
      }
      if (lp < N && lp > 0 && j[i] == s[lp - 1]) {
        if (lp > -1) ans1[lp - 1] = false;
        lp--;
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (ans1[i] || ans2[i]) cnt++;
  }
  cout << N - cnt << endl;
}
