#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> t(q), d(q);
  for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
  int ans = 0;
  int rv = n - 1;
  for (int i = q - 1; i >= 0; i--) {
    if (t[i] == s[rv] && d[i] == 'R') {
      ans++;
      rv--;
    }
  }
  int lv = 0;
  for (int i = q - 1; i >= 0; i--) {
    if (t[i] == s[lv] && d[i] == 'L') {
      ans++;
      lv++;
    }
  }
  cout << n - ans << endl;
}
