#include <bits/stdc++.h>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
struct Query {
  char c;
  char d;
};
int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  std::string s;
  cin >> s;
  std::vector<Query> query;
  query.resize(q);
  for (int i = 0; i < q; i++) {
    Query m1;
    cin >> m1.c;
    cin >> m1.d;
    query[i] = m1;
  }
  bool distinguished[200000] = {};
  char target_c = s[0];
  int target_i = 0;
  for (int i = q - 1; i >= 0; i--) {
    target_c = s[target_i];
    if (target_i == 0) {
      if (query[i].c == target_c && query[i].d == 'R') {
      } else if (query[i].c == target_c && query[i].d == 'L') {
        distinguished[target_i] = true;
        target_i++;
      }
    } else {
      if (query[i].c == target_c && query[i].d == 'L') {
        distinguished[target_i] = true;
        target_i++;
      } else if ((query[i].c == s[target_i - 1] && query[i].d == 'R')) {
        break;
      }
    }
  }
  target_c = s[n - 1];
  target_i = n - 1;
  for (int i = q - 1; i >= 0; i--) {
    target_c = s[target_i];
    if (target_i == n - 1) {
      if (query[i].c == target_c && query[i].d == 'L') {
      } else if (query[i].c == target_c && query[i].d == 'R') {
        distinguished[target_i] = true;
        target_i--;
      }
    } else {
      if (query[i].c == target_c && query[i].d == 'R') {
        distinguished[target_i] = true;
        target_i--;
      } else if ((query[i].c == s[target_i + 1] && query[i].d == 'L')) {
        break;
      }
    }
  }
  int result = 0;
  for (int i = 0; i < n; i++) {
    if (!distinguished[i]) {
      result++;
    } else {
    }
  }
  cout << result << endl;
  return 0;
}
