#include <bits/stdc++.h>
using namespace std;
namespace {
template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) {
  v.assign(a, vector<T>(b, t));
}
template <class T>
inline T &chmin(T &x, const T &y) {
  return x = min(x, y);
}
template <class T>
inline T &chmax(T &x, const T &y) {
  return x = max(x, y);
}
template <class F, class T>
void convert(const F &f, T &t) {
  stringstream ss;
  ss << f;
  ss >> t;
}
void mainmain() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<char> ts(q), ds(q);
  for (int i = 0; i < q; ++i) {
    cin >> ts[i] >> ds[i];
  }
  int lt = 0, rt = n;
  for (int i = q - 1; i >= 0; --i) {
    if (ds[i] == 'L') {
      if (ts[i] == s[lt]) {
        ++lt;
      }
    } else {
      if (ts[i] == s[rt - 1]) {
        --rt;
      }
    }
  }
  cout << rt - lt << endl;
}
}  // namespace
int main() try {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cerr << fixed << setprecision(4);
  mainmain();
} catch (...) {
  throw;
}
