#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  std::vector<int> state;
  for (int i = 1; i <= N; i++) {
    state.push_back(i);
  }
  string s;
  cin >> s;
  string tmp_d, tmp_t;
  std::vector<string> t, d;
  while (cin >> tmp_t >> tmp_d) {
    t.push_back(tmp_t);
    d.push_back(tmp_d);
  }
  int count = 0;
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < N; j++) {
      const char masu = tmp_d[j];
      const char targetmasu = s[i];
      if (state[j] != -1) {
        if (d[j] == "L" && targetmasu == masu) {
          state[j] += -1;
          if (state[j] <= 0) {
            state[j] = -1;
            count += 1;
          }
        } else if (d[j] == "R" && targetmasu == masu) {
          state[j] += 1;
          if (state[j] > N) {
            state[j] = -1;
            count += 1;
          }
        }
      }
    }
  }
  cout << N - count << endl;
  return 0;
}
