#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const long long LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
template <typename T>
T gcd(T a, T b) {
  return (a == 0) ? b : gcd(b % a, a);
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
bool p_comp_fs(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.first < p2.first;
};
bool p_comp_fg(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.first > p2.first;
};
bool p_comp_ss(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.second < p2.second;
};
bool p_comp_sg(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.second > p2.second;
};
template <typename T>
vector<T> uniquen(vector<T> vec) {
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;
}
int main() {
  long long n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> ts(q), ds(q);
  for (long long i = 0; i < q; i++) cin >> ts[i] >> ds[i];
  s = "0" + s + "0";
  long long l = 1, r = n;
  for (long long i = q - 1; i >= 0; i--) {
    if (ts[i] == s[l] && ds[i] == 'L') {
      l = min(l + 1, n);
    } else if (ts[i] == s[l - 1] && ds[i] == 'R') {
      l = max(l - 1, 1ll);
    }
    if (ts[i] == s[r] && ds[i] == 'R') {
      r = max(r - 1, 1ll);
    }
    if (ts[i] == s[r + 1] && ds[i] == 'L') {
      r = min(r + 1, n);
    }
  }
  long long ans = n - (l - 1 + (n - r));
  cout << max(min(n, ans), 0ll) << endstr;
  return 0;
}
