#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
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);
  }
  vector<int> visited(s.size(), INF);
  {
    int pos = 0;
    visited[pos] = v.size();
    bool flg = true;
    while (flg) {
      flg = false;
      for (int i = visited[pos] - 1; i >= 0; 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] = min(visited[pos], i);
            flg = true;
          }
        }
      }
    }
  }
  {
    int pos = s.size() - 1;
    visited[pos] = v.size();
    bool flg = true;
    while (flg) {
      flg = false;
      for (int i = visited[pos] - 1; i >= 0; 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] = min(visited[pos], i);
            flg = true;
          }
        }
      }
    }
  }
  int ret = 0;
  for (int i = (1); i < (int)(visited.size() - 1); i++) {
    if (visited[i] == INF) ret++;
  }
  cout << ret << endl;
  return 0;
}
