#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q;
  string s;
  cin >> n >> q;
  cin >> s;
  pair<char, char> pairs[200010];
  char t, d;
  for (int i = 0; i < q; ++i) {
    cin >> t >> d;
    pairs[i] = make_pair(t, d);
  }
  long long r_res = 0, l_res = 0;
  long long bucketright[200010] = {0};
  long long right = n - 1;
  for (int i = q - 1; i >= 0; i--) {
    if (pairs[i].first == s[right] && pairs[i].second == 'R') {
      if (bucketright[i] == 0) {
        r_res++;
      }
      bucketright[i]++;
      right--;
    }
    if (right != q - 1) {
      if (pairs[i].first == s[right + 1] && pairs[i].second == 'L') {
        right++;
      }
    }
  }
  long long bucketleft[200010] = {0};
  long long left = 0;
  for (int i = q - 1; i >= 0; i--) {
    if (pairs[i].first == s[left] && pairs[i].second == 'L') {
      if (bucketleft[i] == 0) {
        l_res++;
      }
      bucketleft[i]++;
      left++;
    }
    if (left != 0) {
      if (pairs[i].first == s[left - 1] && pairs[i].second == 'R') {
        left--;
      }
    }
  }
  cout << n - r_res - l_res << endl;
}
