#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1};
int dx[] = {
    1,
    -1,
    0,
    0,
};
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<long long> cnt = vector<long long>(N + 2, 1);
  int ans = 0;
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      for (int j = 1; j < N + 1; j++) {
        if (s[j - 1] == t) {
          cnt[j - 1] += cnt[j];
          cnt[j] = 0;
        }
      }
    } else {
      for (int j = 1; j < N + 1; j++) {
        int jj = N + 1 - j;
        if (s[jj - 1] == t) {
          cnt[jj + 1] += cnt[jj];
          cnt[jj] = 0;
        }
      }
    }
    for (int k = 0; k < N + 2; k++) {
    }
  }
  cout << N - (cnt[0] + cnt[N + 1]) + 2 << endl;
}
