#include <bits/stdc++.h>
using namespace std;
using namespace placeholders;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<vector<int> >;
using VS = vector<string>;
using ISS = istringstream;
using OSS = ostringstream;
using PII = pair<int, int>;
using VPII = vector<pair<int, int> >;
template <typename T = int>
using VT = vector<T>;
template <typename T = int>
using VVT = vector<vector<T> >;
template <typename T = int>
using LIM = numeric_limits<T>;
template <typename T>
inline istream &operator>>(istream &s, vector<T> &v) {
  for (T &t : v) {
    s >> t;
  }
  return s;
}
template <typename T>
inline ostream &operator<<(ostream &s, const vector<T> &v) {
  for (int i = 0; i < int(v.size()); ++i) {
    s << (" " + !i) << v[i];
  }
  return s;
}
void in_impl(){};
template <typename T, typename... TS>
void in_impl(T &head, TS &...tail) {
  cin >> head;
  in_impl(tail...);
}
template <typename T>
struct getv_fmt;
template <>
struct getv_fmt<int> {
  static constexpr const char *fmt = "%d";
};
template <>
struct getv_fmt<long long> {
  static constexpr const char *fmt = "%lld";
};
template <typename T>
void getv(std::vector<T> &v) {
  for_each(begin(v), end(v), [](T &a) { scanf(getv_fmt<T>::fmt, &a); });
};
template <typename T>
inline T fromString(const string &s) {
  T res;
  istringstream iss(s);
  iss >> res;
  return res;
}
template <typename T>
inline string toString(const T &a) {
  ostringstream oss;
  oss << a;
  return oss.str();
}
template <typename T>
inline bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(12) << fixed;
  int N, Q;
  in_impl(N, Q);
  ;
  string S;
  in_impl(S);
  ;
  VT<char> T(Q), D(Q);
  for (int i = (int)(0); i < (int)(Q); ++i) {
    cin >> T[i] >> D[i];
  }
  int l = 0, r = N - 1;
  for (int i = Q - 1; 0 <= i; --i) {
    const int t = T[i], d = D[i] == 'L' ? -1 : 1;
    if (d == -1 && S[l] == t) {
      ++l;
    } else if (d == 1 && S[r] == t) {
      --r;
    }
  }
  cout << max(0, r - l + 1) << endl;
  return 0;
}
