#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  s = "*" + s + "*";
  vector<pair<char, char>> v;
  for (int i = (0); i < (int)(Q); i++) {
    char t, d;
    cin >> t >> d;
    v.emplace_back(t, d);
  }
  reverse((v).begin(), (v).end());
  vector<bool> visited(s.size(), false);
  {
    int pos = 0;
    for (int i = (0); i < (int)(v.size()); i++) {
      char t = v[i].first;
      char d = v[i].second;
      if (d == 'L') {
        if (pos + 1 < s.size() && s[pos + 1] == t) {
          pos++;
          visited[pos] = true;
        }
      }
    }
  }
  {
    int pos = s.size() - 1;
    for (int i = (0); i < (int)(v.size()); i++) {
      char t = v[i].first;
      char d = v[i].second;
      if (d == 'R') {
        if (pos - 1 >= 0 && s[pos - 1] == t) {
          pos--;
          visited[pos] = true;
        }
      }
    }
  }
  int ret = 0;
  for (int i = (1); i < (int)(visited.size() - 1); i++) {
    if (!visited[i]) ret++;
  }
  cout << ret << endl;
  return 0;
}
