#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  char td[q][2];
  for (long long i = 0; i < q; i++) {
    cin >> td[q - i - 1][0] >> td[q - i - 1][1];
  }
  long long le = 0;
  long long ri = n - 1;
  for (long long i = 0; i < q; i++) {
    if (le >= ri) {
      cout << 0 << endl;
      return 0;
    }
    if (td[i][1] == 'L' && td[i][0] == s[le])
      le++;
    else if (td[i][1] == 'R' && td[i][0] == s[ri])
      ri--;
  }
  cout << ri - le + 1 << endl;
  return 0;
}
