#include <bits/stdc++.h>
using namespace std;
int N, Q;
string s;
int main() {
  cin >> N >> Q >> s;
  vector<char> t(Q), d(Q);
  for (int i = 1; i < Q + 1; i++) {
    cin >> t[Q - i] >> d[Q - i];
  }
  char left = 0, right = N - 1;
  int west = 0, east = 0;
  for (int i = 0; i < Q; i++) {
    if (t[i] == s[left] && d[i] == 'L') {
      left++;
      west++;
      if (left > N - 1) break;
    } else if (t[i] == s[right] && d[i] == 'R') {
      right--;
      east++;
      if (right < 0) break;
    } else if (left > 0 && t[i] == s[left - 1] && d[i] == 'R') {
      left--;
      west--;
    } else if (right < N - 1 && t[i] == s[right + 1] && d[i] == 'L') {
      right++;
      east--;
    }
  }
  cout << max(N - west - east, 0) << endl;
}
