#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<int> Golem;
  int GolemSum = N;
  for (int i = 0; i < N; i++) Golem.push_back(1);
  for (int i = 0; i < Q; i++) {
    vector<int> t, d;
    int tele, dele;
    cin >> tele >> dele;
    t.push_back(tele);
    d.push_back(dele);
    for (int j = 0; j < N; j++) {
      if (s[j] == t[i]) {
        if (d[i] == 'L') {
          if (Golem[j] == 0)
            continue;
          else if (j == 0) {
            GolemSum -= Golem[j];
            Golem[j] = 0;
          } else {
            Golem[j - 1] += Golem[j];
            Golem[j] = 0;
          }
        } else if (d[i] == 'R') {
          if (Golem[j] == 0)
            continue;
          else if (j == N - 1) {
            GolemSum -= Golem[j];
            Golem[j] = 0;
          } else {
            Golem[j + 1] += Golem[j];
            Golem[j] = 0;
          }
        } else {
          continue;
        }
      }
    }
  }
  cout << GolemSum << endl;
}
