#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

char ts[300000], ds[300000];

int main() {
  int N, Q;
  string s;

  cin >> N >> Q >> s;

  for (int i = Q - 1; i >= 0; i--) {
    char t, d;
    scanf("\n%c %c", &t, &d);
    ts[i] = t; ds[i] = d;
  }

  s = " " + s + " ";
  int l = 1, r = N;

  for (int i = 0; i < Q; i++) {
    char t = ts[i], d = ds[i];
    if (d == 'L') {
      if (s[l] == t && l != 0) l++;
      if (s[r+1] == t && r != 0) r++;
    }
    else if (d == 'R') {
      if (s[r] == t && r != N + 1) r--;
      if (s[l-1] == t && l != N + 1) l--;
    }
  }

  cout << r - l + 1 << endl;
}

