#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);
  }
  vector<int> dp(s.size(), -1);
  {
    int pos = 0;
    dp[pos] = v.size();
    for (int i = v.size() - 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++;
          dp[pos] = max(dp[pos], i);
        }
      }
    }
  }
  {
    int pos = s.size() - 1;
    dp[pos] = v.size();
    for (int i = v.size() - 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--;
          dp[pos] = max(dp[pos], i);
        }
      }
    }
  }
  int st = s.size() + 1;
  for (int i = (0); i < (int)(dp.size()); i++) {
    if (dp[i] == -1) {
      st = i;
      break;
    }
  }
  if (st != s.size() + 1) {
    int ed = st;
    while (ed + 1 < s.size() && dp[ed + 1] == -1) ed++;
    {
      int pos = st;
      for (int i = v.size() - 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 && dp[pos] > i) {
            pos--;
            dp[pos] = -1;
          }
        }
      }
    }
    {
      int pos = ed;
      for (int i = v.size() - 1; i >= 0; i--) {
        char t = v[i].first;
        char d = v[i].second;
        if (d == 'L') {
          if (pos + 1 >= 0 && s[pos + 1] == t && dp[pos] > i) {
            pos++;
            dp[pos] = -1;
          }
        }
      }
    }
  }
  int ret = 0;
  for (int i = (0); i < (int)(dp.size()); i++) {
    if (dp[i] == -1) ret++;
  }
  cout << ret << endl;
  return 0;
}
