#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 10010, MAX_W = 10010, MAX_V = 10010;
int N, Q;
string s;
char t[200010], d[200010];
int main() {
  cin >> N >> Q;
  cin >> s;
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  int ans = 0;
  int r = N - 1;
  int r1 = 0;
  for (int i = Q - 1; i >= 0; i--) {
    if (d[i] == 'R') {
      if (t[i] == s[r]) {
        ans++;
        r1++;
        r--;
      }
    }
  }
  int l = 0;
  int l1 = 0;
  for (int i = Q - 1; i >= 0; i--) {
    if (d[i] == 'L') {
      if (t[i] == s[l]) {
        ans++;
        l1++;
        l++;
      }
    }
  }
  cout << N - ans << endl;
}
