#include <bits/stdc++.h>
constexpr int MAX = 2 * (int)1e5 + 10;
int n, q;
std::string str;
char ch[MAX];
char dir[MAX];
int main() {
  std::cin >> n >> q;
  std::cin >> str;
  for (int i = 0; i < q; ++i) std::cin >> ch[i] >> dir[i];
  int l = 0, r = n + 1;
  for (int i = q - 1; i >= 0; --i) {
    if (l >= r) break;
    if (str[l] == ch[i] && dir[i] == 'L')
      ++l;
    else if (str[r - 2] == ch[i] && dir[i] == 'R')
      --r;
  }
  if (l >= r)
    std::cout << 0 << std::endl;
  else
    std::cout << r - l - 1 << std::endl;
  return 0;
}
