#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string grid, tmp;
  cin >> grid;
  vector<string> dpath_r, dpath_l;
  for (int i = 0; i < N; i++) {
    string Ltmp = grid.substr(i, 1) + " L";
    string Rtmp = grid.substr(N - i - 1) + " R";
    dpath_l.emplace_back(Ltmp);
    dpath_r.emplace_back(Rtmp);
  }
  vector<string> spell;
  for (int i = 0; i < Q; i++) {
    cin >> tmp;
    spell.push_back(tmp);
  }
  bool flag[N];
  for (int i = 0; i < N; i++) flag[i] = true;
  int pl = 0, pr = 0;
  for (int i = Q - 1; i >= 0; i--) {
    if (spell[i] == dpath_l[pl]) {
      flag[pl] = false;
      pl++;
    } else if (spell[i] == dpath_r[pr]) {
      flag[N - 1 - pr] = false;
      pr++;
    }
  }
  int res = 0;
  for (int i = 0; i < N; i++) {
    if (flag[i]) res++;
  }
  cout << res << endl;
  return 0;
}
