#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  char command[q][2];
  for (int i = 0; i < q; i++) {
    cin >> command[i][0] >> command[i][1];
  }
  int pointer_left = 0;
  char pointing_char = s[pointer_left];
  for (int i = q - 1; i >= 0; i--) {
    if (command[i][0] == pointing_char && command[i][1] == 'L') {
      pointer_left++;
      if (pointer_left >= n) {
        break;
      }
      pointing_char = s[pointer_left];
    }
  }
  int pointer_right = n - 1;
  pointing_char = s[pointer_right];
  for (int i = q - 1; i >= 0; i--) {
    if (command[i][0] == pointing_char && command[i][1] == 'R') {
      pointer_right--;
      if (pointer_right < 0) {
        break;
      }
      pointing_char = s[pointer_right];
    }
  }
  int total = (pointer_left - 0) + (n - 1 - pointer_right);
  if (total > n) {
    cout << 0 << '\n';
  } else {
    cout << n - total << '\n';
  }
  return 0;
}
