#include <bits/stdc++.h>
using namespace std;
int INF = 1000000000;
int n, q;
string s;
char t[200010], d[200010];
int lidx, ridx;
int main() {
  cin >> n >> q;
  cin >> s;
  for (int i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
  }
  lidx = 0;
  ridx = n - 1;
  for (int i = q - 1; i >= 0; i--) {
    if (d[i] == 'R') {
      if (t[i] == s[ridx]) ridx--;
      if (lidx > 0) {
        if (t[i] == s[lidx - 1]) lidx--;
      }
    }
    if (d[i] == 'L') {
      if (t[i] == s[lidx]) lidx++;
      if (ridx < (q - 1)) {
        if (t[i] == s[ridx + 1]) ridx++;
      }
    }
  }
  cout << max(0, ridx - lidx + 1) << endl;
}
