#include <bits/stdc++.h>
using namespace std;
inline void fileio(const char* in, const char* out) {
  freopen(in, "r", stdin);
  freopen(out, "w", stdout);
}
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> VI;
typedef vector<bool> VB;
typedef vector<ll> VL;
const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld EPS = 1e-9, PI = acos(-1);
typedef pair<char, char> pcc;
int main() {
  atexit([]() { cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << nl; });
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<pcc> queries(q);
  for (int i = 0; i < (q); ++i) {
    cin >> queries[i].first >> queries[i].second;
  }
  int l = 0, r = n - 1;
  reverse(queries.begin(), queries.end());
  for (pcc que : queries) {
    if (que.second == 'L') {
      if (que.first == s[l]) {
        l++;
      }
    } else {
      if (que.first == s[r]) {
        r--;
      }
    }
    if (l > r) break;
  }
  if (l > r) {
    cout << 0 << nl;
  } else {
    cout << r - l + 1 << nl;
  }
  return 0;
}
