#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX;
constexpr ll llmin = INT_FAST64_MIN;
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX;
int main() {
  int N;
  scanf("%d", &(N));
  getchar();
  ;
  int Q;
  scanf("%d", &(Q));
  getchar();
  ;
  string S;
  cin >> S;
  vector<pair<char, char>> TD;
  for (int q = 0; q < (Q); ++q) {
    char tq;
    char dq;
    cin >> tq >> dq;
    TD.emplace_back(tq, dq);
  }
  int result = N;
  {
    int n = 0;
    for (int q = ((Q)-1); 0 <= q; --q) {
      auto& tq = TD[q].first;
      auto& dq = TD[q].second;
      if (tq == S[n] && dq == 'L') {
        result--;
        n++;
      }
    }
  }
  {
    int n = N - 1;
    for (int q = ((Q)-1); 0 <= q; --q) {
      auto& tq = TD[q].first;
      auto& dq = TD[q].second;
      if (tq == S[n] && dq == 'R') {
        result--;
        n--;
      }
    }
  }
  cout << max(0, result) << endl;
}
