#include <bits/stdc++.h>
using namespace std;
bool LT(double a, double b) { return !(fabs((a) - (b)) < (1e-8)) && a < b; }
bool LTE(double a, double b) { return (fabs((a) - (b)) < (1e-8)) || a < b; }
void compute() {}
bool erased[300000];
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<pair<char, char> > vec(Q);
  for (int i = 0; i < Q; ++i) cin >> vec[i].first >> vec[i].second;
  for (int i = Q - 1; i >= 0; --i) {
    if (vec[i].first == s[N - 1] && vec[i].second == 'R') {
      int tail = N - 1;
      erased[tail--] = true;
      for (int j = i - 1; j >= 0; --j) {
        if (tail >= 0 && s[tail] == vec[j].first && vec[j].second == 'R') {
          erased[tail--] = true;
        }
      }
      break;
    }
  }
  for (int i = Q - 1; i >= 0; --i) {
    if (vec[i].first == s[0] && vec[i].second == 'L') {
      int head = 0;
      erased[head++] = true;
      for (int j = i - 1; j >= 0; --j) {
        if (head < N && s[head] == vec[j].first && vec[j].second == 'L') {
          erased[head++] = true;
        }
      }
      break;
    }
  }
  int ans = N;
  for (int i = 0; i < N; ++i) ans -= erased[i];
  cout << ans << endl;
  compute();
  return 0;
}
