#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> g(n, 1);
  int alive = n;
  for (int i = 0; i < q; ++i) {
    char t, d;
    cin >> t >> d;
    for (int j = 0; j < n; ++j) {
      if (s[j] == t) {
        if (d == 'L') {
          if (j > 0) {
            g[j - 1] += g[j];
          } else {
            alive -= g[j];
            if (alive <= 0) {
              cout << 0 << endl;
              return 0;
            }
          }
          g[j] = 0;
        } else if (d == 'R') {
          if (j < n - 1) {
            g[j + 1] += g[j];
          } else {
            alive -= g[j];
            if (alive <= 0) {
              cout << 0 << endl;
              return 0;
            }
          }
          g[j] = 0;
        }
      }
    }
  }
  cout << alive << endl;
  return 0;
}
