#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string s;
  cin >> N >> Q;
  vector<char> t(Q + 2);
  vector<char> d(Q + 2);
  vector<int> ans(N + 2, 1);
  cin >> s;
  for (int i = 0; i < Q; i++) {
    cin >> t[i + 1] >> d[i + 1];
  }
  string S = 'm' + s + 'm';
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < N + 2; j++) {
      if (S[j] == t[i + 1]) {
        if (d[i + 1] == 'L') {
          ans[j - 1] += ans[j];
          ans[j] = 0;
        } else if (d[i + 1] == 'R') {
          ans[j + 1] += ans[j];
          ans[j] = 0;
        }
      }
    }
  }
  cout << N - ans[0] - ans[N + 1] + 2 << endl;
}
