#include <bits/stdc++.h>
int main() {
  int N, Q;
  std::string s;
  char t[100001], d[100001];
  std::cin >> N >> Q >> s;
  for (int i = 0; i < Q; i++) std::cin >> t[i] >> d[i];
  int L = 0, R = N;
  for (int i = Q - 1; i >= 0; i--) {
    if (s[R - 1] == t[i] && R > 0 && d[i] == 'R')
      R--;
    else if (s[R] == t[i] && R < N && d[i] == 'L')
      R++;
    if (s[L - 1] == t[i] && L > 0 && d[i] == 'R')
      L--;
    else if (s[L] == t[i] && L < N && d[i] == 'L')
      L++;
  }
  std::cout << R - L << '\n';
}
