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