#include <bits/stdc++.h>
const int INF = 1e9, MOD = 1e9 + 7;
const long long LINF = 1e18;
using namespace std;
signed main() {
  long long N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  std::vector<char> t(Q), d(Q);
  for (long long i = 0; i < Q; i++) cin >> t[i] >> d[i];
  long long now = 0;
  for (long long i = Q - 1; i >= 0; i--) {
    if (t[i] == s[now] && d[i] == 'L') now++;
    if (now == 0) continue;
    if (t[i] == s[now - 1] && d[i] == 'R') now--;
  }
  long long now2 = N - 1;
  for (long long i = Q - 1; i >= 0; i--) {
    if (t[i] == s[now2] && d[i] == 'R') now2--;
    if (now2 == N - 1) continue;
    if (t[i] == s[now + 1] && d[i] == 'L') now2++;
  }
  if (now == now2)
    cout << 0 << endl;
  else
    cout << N - (now + N - 1 - now2) << endl;
}
