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