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