#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  long long n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> a(q), d(q);
  for (long long i = 0; i < q; i++) cin >> a[i] >> d[i];
  long long ans = 0;
  long long now = 0;
  for (long long i = q - 1; i >= 0; i--) {
    if (a[i] == s[now] && d[i] == 'L') {
      ans++;
      now++;
    }
  }
  now = n - 1;
  auto awe = s[now];
  for (long long i = q - 1; i >= 0; i--) {
    auto jk = a[i];
    if (a[i] == s[now] && d[i] == 'R') {
      ans++;
      now--;
    }
  }
  cout << n - ans << endl;
  ;
}
