#include <bits/stdc++.h>
using namespace std;
template <typename iterator>
void majicshift(string s, iterator begin, int N) {
  char t, d;
  cin >> t >> d;
  int p, q = 0;
  while ((p = s.find_first_of(t)) >= 0) {
    q += (p + 1);
    if (d == 'L') {
      if (q > 1) *(begin + (q - 2)) += *(begin + (q - 1));
    } else {
      if (q < N) *(begin + q) += *(begin + (q - 1));
    }
    *(begin + (q - 1)) = 0;
    s.erase(s.begin(), s.begin() + p + 1);
  }
}
int main(void) {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<int> Golems(N, 1);
  while (Q--) majicshift(s, Golems.begin(), N);
  int sum = 0;
  while (N--) sum += Golems.at(N);
  cout << sum << endl;
}
