#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint MOD = 1e9 + 7;
const int INF = 1e9;
const lint LINF = 1e18;
using flt = double;
const flt PI = acos(-1.0);
template <typename Tp>
Tp gcd(Tp m, Tp n) {
  if (!m || !n) {
    cout << "GCD error: zero inputed" << endl;
    return 0;
  } else if (!(m % n))
    return n;
  else
    return gcd(n, m % n);
}
template <typename Tp>
Tp lcm(Tp m, Tp n) {
  if (!m || !n) {
    cout << "LCM warning: zero inputed" << endl;
    return 0;
  } else
    return m * n / gcd(m, n);
}
template <typename Tp>
Tp ipow(Tp a, Tp p) {
  if (p < 0) {
    cout << "Power error: a minus number inputed" << endl;
    return 0;
  } else if (!p)
    return 1;
  Tp res = a, rem = 1;
  while (p > 1) {
    if (p % 2 == 1) rem *= res;
    res *= res;
    p /= 2;
  }
  return rem * res;
}
template <typename Tp>
Tp comb(Tp n, Tp r) {
  if (n < 0 || r < 0) {
    cout << "Combination warning: a minus number inputed" << endl;
    return 0;
  } else {
    lint res = 1;
    for (int i = 0; i < r; i++) res *= (n - i) / (i + 1);
    return res;
  }
}
template <typename Tp>
Tp fact(Tp n) {
  if (n < 0) {
    cout << "Factorial error: a minus number inputed" << endl;
    return 0;
  } else if (!n)
    return 1;
  else if (n == 1)
    return 1;
  else
    return n * fact(n - 1);
}
template <typename Tp>
void pfact(Tp n, map<Tp, int>& make_pair) {
  if (n < 2) {
    cout << "Prime factorization error: cannot factorize an integer less than 2"
         << endl;
    return;
  }
  if (make_pair.size())
    cout << "Prime factorization warning: the map may already contain some "
            "numbers"
         << endl;
  Tp pos = 2, pmax = n;
  while (pos * pos <= pmax) {
    if (!(n % pos)) {
      make_pair[pos]++;
      n /= pos;
    } else
      pos++;
  }
  if (n != 1) make_pair[n]++;
  return;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q;
  string s;
  vector<char> t(Q);
  vector<char> d(Q);
  cin >> N >> Q;
  cin >> s;
  for (int i = 0; i < Q; i++) cin >> t[i] >> d[i];
  int live_left = 0, live_right = N - 1;
  for (int i = Q - 1; i >= 0; i--) {
    if (t[i] == s[live_left] && d[i] == 'L') {
      live_left++;
    }
    if (t[i] == s[live_right] && d[i] == 'R') {
      live_right--;
    }
    if (live_left >= live_right) break;
  }
  cout << max(0, live_right - live_left + 1) << endl;
  return 0;
}
