#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using P = pair<ll, ll>;

const int MAX = 2e5;

int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  char t[Q], d[Q];
  for (int i = 0; i < Q; i++) cin >> t[i] >> d[i];

  int left = -1, right = N;
  for (int i = Q - 1; i >= 0; i--) {
    if (d[i] == 'R') {
      if (t[i] == s[right - 1]) {
        right--;
      }
      if (left > -1 && t[i] == s[left]) {
        left--;
      }
    } else {
      if (t[i] == s[left + 1]) {
        left++;
      }
      if (right < N && t[i] == s[right]) {
        right++;
      }
    }
  }

  cout << max(right - left - 1, 0) << endl;
  return 0;
}
