#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
int main(int argc, char *argv[]) {
  long long int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> t(Q), d(Q);
  for (int i = 0; i < Q; i++) cin >> t[i] >> d[i];
  reverse(t.begin(), t.end());
  reverse(d.begin(), d.end());
  vector<bool> flag(N, false);
  long long int l = 0, r = N - 1;
  long long int ans = 0;
  for (long long int i = 0; i < Q; i++) {
    r = min(N - 1, r);
    l = max(0LL, l);
    if (l > r) break;
    if (t[i] == s[l] && d[i] == 'L') {
      ans++;
      l++;
    } else if (t[i] == s[l + 1] && d[i] == 'R') {
      l--;
    }
    if (t[i] == s[r] && d[i] == 'R') {
      ans++;
      r--;
    } else if (t[i] == s[r - 1] && d[i] == 'L') {
      r++;
    }
  }
  cout << N - ans << endl;
  return 0;
}
