#include <bits/stdc++.h>
using namespace std;
long long MOD = (long long)1e9 + 7;
long long INF = (long long)2e18;
signed main() {
  long long N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  vector<pair<char, char>> TD(Q);
  vector<bool> check(N + 2, false);
  for (long long i = 0; i < Q; i++) {
    cin >> TD[i].first >> TD[i].second;
  }
  check[0] = true;
  check[N + 1] = true;
  S = "-" + S + "-";
  long long nowCoordinate = 0;
  long long ans = 0;
  for (long long i = Q - 1; i >= 0; --i) {
    if (nowCoordinate != N + 1 && TD[i].second == 'L' &&
        S[nowCoordinate + 1] == TD[i].first) {
      ++nowCoordinate;
      if (!check[nowCoordinate]) {
        ++ans;
        check[nowCoordinate] = true;
      }
    } else if (nowCoordinate != 0 && TD[i].second == 'R' &&
               S[nowCoordinate - 1] == TD[i].first) {
      --nowCoordinate;
      if (!check[nowCoordinate]) {
        ++ans;
        check[nowCoordinate] = true;
      }
    }
  }
  nowCoordinate = N + 1;
  for (long long i = Q - 1; i >= 0; --i) {
    if (nowCoordinate != N + 1 && TD[i].second == 'L' &&
        S[nowCoordinate + 1] == TD[i].first) {
      ++nowCoordinate;
      if (!check[nowCoordinate]) {
        ++ans;
        check[nowCoordinate] = true;
      }
    } else if (nowCoordinate != 0 && TD[i].second == 'R' &&
               S[nowCoordinate - 1] == TD[i].first) {
      --nowCoordinate;
      if (!check[nowCoordinate]) {
        ++ans;
        check[nowCoordinate] = true;
      }
    }
  }
  cout << N - ans << endl;
}
