#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  std::string s;
  cin >> N >> Q >> s;
  vector<char> t(Q);
  vector<char> d(Q);
  vector<int> gorem(N);
  int num_gorem = N;
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  for (int i = 0; i < N; i++) {
    gorem[i] = i;
  }
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < s.size(); j++) {
      if (t.at(i) == s[j]) {
        if (d.at(i) == 'L')
          gorem[j]--;
        else
          gorem[j]++;
        if (gorem.at(i) <= -1 || gorem.at(i) >= N) num_gorem--;
      }
    }
  }
  cout << num_gorem;
  return 0;
}
