#include <bits/stdc++.h>
const int INF = 1e9;
const int MO = 1e9 + 7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class PalseError {};
class Edge {
 public:
  LL from, to, value;
  Edge(LL a, LL b, LL c) {
    from = a;
    to = b;
    value = c;
  }
  Edge(LL a, LL b) {
    from = a;
    to = b;
  }
};
int main() {
  int N, Q;
  cin >> N >> Q;
  string second;
  cin >> second;
  second.insert(second.begin(), ' ');
  second.push_back(' ');
  vector<pair<char, char>> vec;
  for (int a = 0; a < Q; a++) {
    char t, d;
    cin >> t >> d;
    vec.push_back({t, d});
  }
  reverse(vec.begin(), vec.end());
  vector<bool> flag(N + 2, false);
  flag.front() = true;
  flag.back() = true;
  int le = 0;
  int ri = N + 1;
  for (int i = 0; i < Q; i++) {
    if (second.at(le + 1) == vec.at(i).first && vec.at(i).second == 'L') {
      flag.at(le + 1) = true;
      le++;
    }
    if (second.at(ri - 1) == vec.at(i).first && vec.at(i).second == 'R') {
      flag.at(ri - 1) = true;
      ri--;
    }
  }
  cout << count(flag.begin(), flag.end(), false) << endl;
}
