#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<char, char>;
constexpr ll INF = 1LL << 62;
int main(void) {
  ll N, Q;
  string S;
  cin >> N >> Q;
  cin >> S;
  vector<bool> mark(N + 2, false);
  ll lt = 0, rt = N + 1;
  mark[lt] = true;
  mark[rt] = true;
  vector<p> R;
  for (ll i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      R.push_back(p(t, 'R'));
    } else {
      R.push_back(p(t, 'L'));
    }
  }
  for (ll i = R.size() - 1; i >= 0; i--) {
    auto t = R[i].first;
    auto d = R[i].second;
    if (d == 'L') {
      if (lt > 1 && S[lt - 2] == t) {
        lt--;
      }
      if (S[rt - 2] == t) {
        rt--;
      }
    } else {
      if (S[lt] == t) {
        lt++;
      }
      if (rt < N && S[rt] == t) {
        rt++;
      }
    }
    mark[lt] = true;
    mark[rt] = true;
  }
  ll ans = N + 2;
  for (auto m : mark) {
    if (m) {
      ans--;
    }
  }
  cout << ans << endl;
  return 0;
}
