#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
using namespace std;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
constexpr int INF = 1 << 30;
constexpr long long LINF = 1LL << 60;
constexpr long long mod = 1e9 + 7;
void flush() { cout << flush; }
template <class T>
vector<T> vec(int len, T elem) {
  return vector<T>(len, elem);
}
template <class T>
inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline int popcount(T a) {
  return __builtin_popcount(a);
}
template <class T>
inline T emod(T a, T p) {
  return (a % p + p) % p;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << '\n';
  for (auto v : vec) os << v << ' ';
  os << '\n';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &vec) {
  os << "deq[";
  for (auto v : vec) os << v << ',';
  os << ']';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &vec) {
  os << '{';
  for (auto v : vec) os << v << ',';
  os << '}';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &vec) {
  os << '{';
  for (auto v : vec) os << v << ',';
  os << '}';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &vec) {
  os << '{';
  for (auto v : vec) os << v << ',';
  os << '}';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &vec) {
  os << '{';
  for (auto v : vec) os << v << ',';
  os << '}';
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &pa) {
  os << '(' << pa.first << ',' << pa.second << ')';
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &mp) {
  os << '{';
  for (auto v : mp) os << v.first << "=>" << v.second << ',';
  os << '}';
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp) {
  os << '{';
  for (auto v : mp) os << v.first << "=>" << v.second << ',';
  os << '}';
  return os;
}
struct MyIO {
  MyIO() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
  }
} IO_OI;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  int left = -1;
  int right = n;
  vector<char> t(q);
  vector<char> d(q);
  for (int i = 0; i < (q); i++) cin >> t[i] >> d[i];
  reverse((t).begin(), (t).end());
  reverse((d).begin(), (d).end());
  for (int i = 0; i < (q); i++) {
    if (d[i] == 'R') {
      if (s[right - 1] == t[i]) right--;
    } else {
      if (s[left + 1] == t[i]) left++;
    }
    (void(0));
  }
  cout << right - 1 - left << "\n";
}
