#include <bits/stdc++.h>
int main() {
  int N, Q;
  std::cin >> N >> Q;
  char S[N + 1];
  char t[Q], d[Q];
  std::cin >> S;
  for (int i = 0; i < Q; i++) std::cin >> t[i] >> d[i];
  int pt[N];
  int num_pt = 0;
  bool flag[N];
  for (int i = 0; i < N; i++) flag[i] = false;
  for (int i = Q - 1; i >= 0; i--) {
    for (int j = 0; j < num_pt; j++) {
      if (S[pt[j]] == t[i]) {
        if (d[i] == 'L') {
          pt[j]--;
          flag[pt[j]] = true;
        } else {
          pt[j]++;
          flag[pt[j]] = true;
        }
      }
    }
    if (t[i] == S[0] && d[i] == 'L') {
      pt[num_pt] = 0;
      flag[0] = true;
      num_pt++;
    }
    if (t[i] == S[N - 1] && d[i] == 'R') {
      pt[num_pt] = N - 1;
      flag[N - 1] = true;
      num_pt++;
    }
  }
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (flag[i] == false) count++;
  }
  std::cout << count << std::endl;
  return 0;
}
