#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = std::vector<T>;
template <class T>
using vvec = vec<vec<T>>;
constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }
int main() {
  using namespace std;
  int n, q;
  string s;
  cin >> n >> q >> s;
  s = " " + s + " ";
  int l = 0, r = n + 1;
  vec<pair<char, char>> v(q);
  for (auto& e : v) {
    cin >> e.first >> e.second;
  }
  for (int i = q - 1; i >= 0; --i) {
    if (v[i].second == 'R') {
      if (s[r - 1] == v[i].first) --r;
    } else {
      if (s[l + 1] == v[i].first) ++l;
    }
  }
  cout << r - l - 1 << endl;
  return 0;
}
