#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll a = 0, b = 0, e, k = 0, l, m, n, o = 0, p, q, x, y, z, max1 = 0, ans,
     co = 0;
  string s, u;
  cin >> n >> q >> s;
  ll c[n];
  char t[q], d[q];
  for (ll i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
  }
  for (ll i = q - 1; i >= 0; i--) {
    if (s[o] == t[i]) {
      if (d[i] == 'L') {
        if (s[o] != s[o + 1]) {
          co++;
          o++;
        }
      }
    }
  }
  o = n - 1;
  for (ll i = q - 1; i >= 0; i--) {
    if (s[o] == t[i]) {
      if (d[i] == 'R') {
        if (s[o] != s[o - 1]) {
          co++;
          o--;
        }
      }
    }
  }
  cout << n - co << endl;
}
