#include <bits/stdc++.h>
using namespace std;
long long int data[200100];
signed main() {
  long long int n, q;
  cin >> n >> q;
  string str;
  cin >> str;
  long long int left = 0;
  long long int right = n - 1;
  vector<char> t(q), d(q);
  for (long long int i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
  }
  long long int ans = 0;
  for (long long int i = q - 1; i >= 0; i--) {
    if (d[i] == 'L') {
      if (str.at(left) == t[i]) {
        ans++;
        left++;
      }
    } else {
      if (str.at(right) == t[i]) {
        ans++;
        right--;
      }
    }
    if (left == right) break;
  }
  cout << n - ans << endl;
  return 0;
}
