#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int INF = 1e9;
const long long int MAXN = 1e9;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> t(q), d(q);
  for (int i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
  }
  vector<int> flag(n, -1);
  int prev = -1;
  int i = 0;
  int ans = 0;
  while (i < q) {
    if (t[i] == s[0] && d[i] == 'L') {
      int now = 0;
      int res = 0;
      if (flag[0] < 0) {
        flag[0]++;
        res++;
      }
      for (int j = i - 1; j > prev; j--) {
        if (t[j] == s[now] && d[j] == 'R') break;
        if (t[j] == s[now + 1] && d[j] == 'L') {
          now++;
          if (flag[now] < 0) {
            flag[now]++;
            res++;
          }
        }
      }
      ans += res;
      prev = i;
    }
    i++;
  }
  prev = -1;
  i = 0;
  while (i < n) {
    if (t[i] == s[n - 1] && d[i] == 'R') {
      int now = n - 1;
      int res = 0;
      if (flag[n - 1] < 0) {
        flag[n - 1]++;
        res++;
      }
      for (int j = i - 1; j > prev; j--) {
        if (t[j] == s[now] && d[j] == 'L') break;
        if (t[j] == s[now - 1] && d[j] == 'R') {
          now--;
          if (flag[now] < 0) {
            flag[now]++;
            res++;
          }
        }
      }
      ans += res;
      prev = i;
    }
    i++;
  }
  cout << n - ans << endl;
  return 0;
}
