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