#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string s;
  char t[200001];
  char d[200001];
  int count = 0;
  int sidx_l = 0;
  int sidx_r = 0;
  int pcountl = 0;
  int pcountr = 0;
  cin >> N >> Q;
  cin >> s;
  for (int i = 1; i <= Q; i++) {
    cin >> t[i] >> d[i];
  }
  sidx_r = N - 1;
  for (int i = Q; i >= 1; i--) {
    if (s[sidx_l] == t[i] && d[i] == 'L') {
      count++;
      pcountl++;
      sidx_l++;
    }
    if (s[sidx_l] == t[i] && d[i] == 'R') {
      count -= pcountl;
      pcountl = 0;
    }
    if (sidx_l > sidx_r) break;
    if (s[sidx_r] == t[i] && d[i] == 'R') {
      count++;
      pcountr++;
      sidx_r--;
    }
    if (s[sidx_r] == t[i] && d[i] == 'L') {
      count -= pcountr;
      pcountr = 0;
    }
    if (sidx_l > sidx_r) break;
  }
  cout << N - count;
  return 0;
}
