#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const long long mod = 1000000007;
const long long inf = long long(1e9);
const long long half_inf = long long(1e5);
const long long ll_inf = long long(1e9) * long long(1e9);
unordered_map<long long, long long> mp;
int main() {
  long long n, q;
  string s;
  cin >> n >> q >> s;
  char t[q], d[q];
  for (long long i = 0; i < (long long)(q); i++) cin >> t[i] >> d[i];
  int il = 0, ir = s.size() - 1;
  for (long long i = q - 1; i >= 0; i--) {
    if (t[i] == s[il] && d[i] == 'L') il++;
    if (t[i] == s[ir] && d[i] == 'R') ir--;
  }
  if (il > ir)
    cout << 0 << endl;
  else
    cout << ir - il + 1 << endl;
  return 0;
}
