#include <bits/stdc++.h>
#pragma GCC optimize("O3")
void solve();
using namespace std;
using LL = long long;
using ULL = unsigned long long;
struct unit {};
using int128 = __int128;
using LD = long double;
template <typename T>
using vec = vector<T>;
template <typename T>
using vvec = vec<vec<T>>;
template <typename T>
using vvvec = vec<vvec<T>>;
template <typename T>
using vvvvec = vec<vvvec<T>>;
using VS = vec<string>;
template <typename T>
inline bool amax(T& v, const T& a) {
  return v < a && (v = a, true);
}
template <typename T>
inline bool amin(T& v, const T& a) {
  return v > a && (v = a, true);
}
namespace kpl {
template <class V, class W>
static inline void append(V& v, const W& w) {
  copy(cbegin(w), cend(w), back_inserter(v));
}
template <class V>
static inline auto flatten(const V& xss, unsigned reserve_size = 0)
    -> vector<decltype(*begin(*begin(xss)))> {
  decltype(flatten(xss)) ret;
  ret.reserve(reserve_size);
  for (const auto& xs : xss) append(ret, xs);
  ret.shrink_to_fit();
  return move(ret);
}
template <class I>
static inline bool is_in(I x, I l, I r) {
  return l <= x && x < r;
}
}  // namespace kpl
template <class T, class U = T>
T exchange_RAB(T& t, U&& u) {
  T ret = move(t);
  t = forward<U>(u);
  return ret;
}
template <class T>
constexpr const T& clamp_RAB(const T& a, const T& mn, const T& mx) {
  return a < mn ? mn : a > mx ? mx : a;
}
template <class V>
void uniq_after_sort(V& v) {
  v.erase(unique(begin(v), end(v)), v.end());
}
template <class V>
void sort_and_uniq(V& v) {
  sort(begin(v), end(v));
  v.erase(unique(begin(v), end(v)), v.end());
}
template <class T>
T power(T x, LL n) {
  T rt(1);
  for (; n; n /= 2) {
    if (n % 2) rt *= x;
    x *= x;
  }
  return rt;
}
LL pow_mod(LL x, LL n, LL m) {
  LL rt = 1;
  for (; n; n /= 2) {
    if (n % 2) rt = rt * x % m;
    x = x * x % m;
  }
  return rt;
}
LL pow_mod_64(int128 x, LL n, LL m) {
  int128 rt = 1;
  for (; n; n /= 2) {
    if (n % 2) rt = rt * x % m;
    x = x * x % m;
  }
  return rt;
}
inline constexpr LL modulo(LL a, LL m) { return (a %= m, a >= 0 ? a : a + m); }
template <ULL mod = 1000000007>
class MInt {
 public:
  LL val;
  constexpr MInt() : val(0) {}
  explicit constexpr MInt(LL v) : val(modulo(v, mod)) {}
  MInt& operator+=(const MInt& m) {
    val += m.val;
    if (val >= mod) val -= mod;
    return *this;
  }
  MInt& operator-=(const MInt& m) {
    val -= m.val;
    if (val < 0) val += mod;
    return *this;
  }
  MInt& operator*=(const MInt& m) {
    val = val * m.val % mod;
    return *this;
  }
  MInt& operator/=(const MInt& m) {
    val = val * m.inv().val % mod;
    return *this;
  }
  MInt operator+(const MInt& m) const { return MInt(*this) += m; }
  MInt operator-(const MInt& m) const { return MInt(*this) -= m; }
  MInt operator*(const MInt& m) const { return MInt(*this) *= m; }
  MInt operator/(const MInt& m) const { return MInt(*this) /= m; }
  MInt operator-() const {
    MInt m;
    m.val = val ? mod - val : 0;
    return m;
  }
  bool operator==(const MInt& m) const { return val == m.val; }
  bool operator!=(const MInt& m) const { return val != m.val; }
  MInt pow(LL n) const { return power(*this, n); }
  MInt inv() const {
    LL a = val, b = mod, x = 1, y = 0, t;
    while (b) {
      t = a / b;
      swap(b, a -= t * b);
      swap(y, x -= t * y);
    }
    return (MInt)x;
  }
  friend ostream& operator<<(ostream& o, const MInt<mod>& m) {
    return o << m.val;
  }
  friend istream& operator>>(istream& i, MInt<mod>& m) {
    LL v;
    i >> v;
    m = MInt<mod>(v);
    return i;
  }
};
using mint = MInt<>;
constexpr mint operator"" _m(ULL n) { return mint(n); }
constexpr MInt<998244353> operator"" _m998244353(ULL n) {
  return MInt<998244353>(n);
}
constexpr MInt<1000000007> operator"" _m1e9_7(ULL n) {
  return MInt<1000000007>(n);
}
constexpr MInt<1000000009> operator"" _m1e9_9(ULL n) {
  return MInt<1000000009>(n);
}
template <class T>
inline istream& operator>>(istream& s, vec<T>& v) {
  for (auto&& p : v) s >> p;
  return s;
}
template <class T, class S>
inline ostream& operator<<(ostream& s, const pair<T, S>& p) {
  return s << "(" << p.first << "," << p.second << ")";
}
template <class T>
inline ostream& operator<<(ostream&, const vec<T>&);
template <class T, class S>
inline ostream& operator<<(ostream&, const map<T, S>&);
template <class T>
inline ostream& operator<<(ostream& s, const vec<T>& v) {
  LL i = 0;
  for (const auto& v0_elem : v) {
    if (i++) s << ' ';
    s << v0_elem;
  }
  return s;
}
template <class T, class S>
inline ostream& operator<<(ostream& s, const map<T, S>& m) {
  LL i = 0;
  for (const auto& m0_elem : m) {
    if (i++) s << ' ';
    s << m0_elem;
  }
  return s;
}
template <class T>
inline ostream& operator<<(ostream& s, const vec<vec<T>>& w) {
  LL i = 0;
  for (const auto& w0_elem : w) {
    if (i++) s << '\n';
    s << w0_elem;
  }
  return s;
}
template <class T, class S>
inline ostream& operator<<(ostream& s, const vec<map<T, S>>& v) {
  LL i = 0;
  for (const auto& v0_elem : v) {
    if (i++) s << '\n';
    s << v0_elem;
  }
  return s;
}
signed main() {
  if (false) cerr << "MOD: " << (1000000007) << '\n';
  if (!false) {
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
  cout << fixed << setprecision(20);
  cerr << fixed << setprecision(20);
  solve();
  return 0;
}
LL di4[] = {-1, 0, 1, 0}, dj4[] = {0, 1, 0, -1};
LL di8[] = {-1, -1, 0, 1, 1, 1, 0, -1}, dj8[] = {0, 1, 1, 1, 0, -1, -1, -1, -1};
LL di_knight[] = {-2, -1, 1, 2, 2, 1, -1, -2},
   dj_knight[] = {1, 2, 2, 1, -1, -2, -2, -1};
namespace dict {
[[maybe_unused]] constexpr char YES[] = "YES", Yes[] = "Yes", yes[] = "yes",
                                NO[] = "NO", No[] = "No", no[] = "no",
                                WIN[] = "WIN", Win[] = "Win", win[] = "win",
                                LOSE[] = "LOSE", Lose[] = "Lose",
                                lose[] = "lose", OK[] = "OK", ok[] = "ok",
                                NG[] = "NG", ng[] = "ng", NA[] = "NA",
                                na[] = "na", AC[] = "AC", ac[] = "ac",
                                WA[] = "WA", wa[] = "wa", PRIME[] = "PRIME",
                                Prime[] = "Prime", prime[] = "prime",
                                NOT_PRIME[] = "NOT PRIME",
                                Not_Prime[] = "Not Prime",
                                not_prime[] = "not prime", ALICE[] = "ALICE",
                                Alice[] = "Alice", alice[] = "alice",
                                BROWN[] = "BROWN", Brown[] = "Brown",
                                brown[] = "brown", BOB[] = "BOB", Bob[] = "Bob",
                                bob[] = "bob", SAME[] = "SAME", Same[] = "Same",
                                same[] = "same", DIFFERENT[] = "DIFFERENT",
                                Different[] = "Different",
                                different[] = "different",
                                TAKAHASHI[] = "TAKAHASHI",
                                Takahashi[] = "Takahashi",
                                takahashi[] = "takahashi", AOKI[] = "AOKI",
                                Aoki[] = "Aoki", aoki[] = "aoki";
}
void solve() {
  LL N;
  LL Q;
  string S;
  cin >> N;
  cin >> Q;
  cin >> S;
  VS T(Q);
  VS D(Q);
  for (auto rab_base_dest = (Q), Ri_0 = decltype(Q)(0); Ri_0 < rab_base_dest;
       Ri_0++) {
    cin >> T[Ri_0];
    cin >> D[Ri_0];
  }
  LL l = 0, r = N - 1;
  for (auto rab_base_dest = decltype((Q)-1)(0), i = ((Q)-1); i >= rab_base_dest;
       i--) {
    if (D[i][0] == 'L') {
      if (l < N && S[l] == T[i][0]) ++l;
    } else {
      if (r >= 0 && S[r] == T[i][0]) --r;
    }
  }
  cout << max(0ll, r - l + 1) << '\n';
}
