#include <bits/stdc++.h>
using namespace std;
char t[250000], d[250000];
signed main() {
  long long n, q, ans = 0;
  cin >> n >> q;
  string s;
  cin >> s;
  for (long long i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
  }
  char now = s[s.size() - 1];
  long long a = s.size() - 1, b = -1;
  for (long long i = q - 1; i >= 0; i--) {
    if (d[i] == 'R' && now == t[i]) {
      ans++;
      a--;
      now = s[a];
      b = i;
    }
  }
  for (long long i = 0; i < b; i++) {
    if (d[i] == 'L' && s[a - 1] == t[i]) {
      ans--;
      break;
    }
  }
  a = 0, b = -1;
  now = s[0];
  for (long long i = q - 1; i >= 0; i--) {
    if (d[i] == 'L' && now == t[i]) {
      ans++;
      a++;
      now = s[a];
      b = i;
    }
  }
  for (long long i = 0; i < b; i++) {
    if (d[i] == 'R' && s[a - 1] == t[i]) {
      ans--;
      break;
    }
  }
  cout << n - ans << endl;
  getchar();
  getchar();
  return 0;
}
