#include <bits/stdc++.h>
using namespace std;
bool f[200009];
vector<pair<char, char> > vec;
int main() {
  int n, q;
  string s;
  cin >> n >> q;
  cin >> s;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    vec.push_back(pair<char, char>(t, d));
  }
  reverse(vec.begin(), vec.end());
  int lx = n - 1, rx = 0;
  for (int i = 0; i < q; i++) {
    pair<char, char> now = vec[i];
    char t = now.first;
    char d = now.second;
    if (d == 'L') {
      if (s[rx] == t) {
        f[rx] = 1;
        rx++;
      }
    } else {
      if (s[lx] == t) {
        f[lx] = 1;
        lx--;
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (f[i] == 0) cnt++;
  }
  cout << cnt << endl;
  return (0);
}
