#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long INF = 1LL << 60;
const long long mod = 1e9 + 7;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
using Graph = vector<vector<int> >;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int n, q;
string s;
void solve() {
  cin >> n >> q;
  cin >> s;
  vector<char> t(q), d(q);
  for (int i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
  }
  reverse(t.begin(), t.end());
  reverse(d.begin(), d.end());
  int l = 0, r = n;
  for (int i = 0; i < q; i++) {
    if (t[i] == s[l] && d[i] == 'L') {
      ++l;
    }
    if (t[i] == s[r - 1] && d[i] == 'R') {
      --r;
    }
  }
  if (r <= l) {
    cout << 0 << endl;
  } else {
    cout << r - l << endl;
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
