#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 58;
const long long MOD = 1000000007;
struct Edge {
  long long s, t, d;
};
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
signed main() {
  long long N, Q;
  string s;
  cin >> N >> Q;
  cin >> s;
  vector<pair<char, char>> td;
  td.resize(Q);
  for (long long i = 0; i < Q; i++) cin >> td[i].first >> td[i].second;
  bool R, L;
  R = false;
  L = false;
  long long tmp;
  long long ans = 0;
  for (long long i = Q - 1; i >= 0; i--) {
    if (!L and td[i].first == s[0] and td[i].second == 'L') {
      tmp = 1;
      ans++;
      for (long long j = i - 1; j >= 0; j--) {
        if (td[j].first == s[tmp] and td[j].second == 'L') {
          ans++;
          tmp++;
        }
      }
      L = true;
    }
    if (!R and td[i].first == s[N - 1] and td[i].second == 'R') {
      tmp = N - 2;
      ans++;
      for (long long j = i - 1; j >= 0; j--) {
        if (td[j].first == s[tmp] and td[j].second == 'R') {
          ans++;
          tmp--;
        }
      }
      R = true;
    }
  }
  cout << N - ans << endl;
}
