#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;
constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1),
                          make_pair(0, -1)};
constexpr char BR = '\n';
template <class T>
inline int argmin(vector<T> vec) {
  return min_element(vec.begin(), vec.end()) - vec.begin();
}
template <class T>
inline int argmax(vector<T> vec) {
  return max_element(vec.begin(), vec.end()) - vec.begin();
}
template <class T>
inline void chmax(T &a, T b) {
  a = max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = min(a, b);
}
inline int toInt(string &s) {
  int res = 0;
  for (char a : s) res = 10 * res + (a - '0');
  return res;
}
inline int toInt(const string s) {
  int res = 0;
  for (char a : s) res = 10 * res + (a - '0');
  return res;
}
inline long long int toLong(string &s) {
  lli res = 0;
  for (char a : s) res = 10 * res + (a - '0');
  return res;
}
inline long long int toLong(const string s) {
  lli res = 0;
  for (char a : s) res = 10 * res + (a - '0');
  return res;
}
template <class T>
inline std::string toString(T n) {
  if (n == 0) return "0";
  std::string res = "";
  if (n < 0) {
    n = -n;
    while (n != 0) {
      res += (char)(n % 10 + '0');
      n /= 10;
    }
    std::reverse(res.begin(), res.end());
    return '-' + res;
  }
  while (n != 0) {
    res += (char)(n % 10 + '0');
    n /= 10;
  }
  std::reverse(res.begin(), res.end());
  return res;
}
inline int AtoInt(char a) { return (int)(a - 'A'); }
constexpr int num_alpha = 26;
int main(void) {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  using D1 = pair<char, bool>;
  using D2 = vector<D1>;
  D2 Qs(q);
  for (int(i) = (0); (i) < (q); (i)++) {
    char a, b;
    cin >> a >> b;
    bool acc = (b == 'L');
    Qs.at(i) = make_pair(a, acc);
  }
  int l = 0, r = n - 1;
  for (auto P = Qs.end(); P != Qs.begin() - 1; P--) {
    char a = P->first;
    bool acc = P->second;
    if (acc) {
      if (s.at(l) == a) l++;
    }
    if (l > r) break;
  }
  for (auto P = Qs.end(); P != Qs.begin() - 1; P--) {
    char a = P->first;
    bool acc = P->second;
    if (not acc) {
      if (s.at(r) == a) r--;
    }
    if (l > r) break;
  }
  cout << r - l + 1 << BR;
  return 0;
}
