#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<vector<char>> ql(q, vector<char>(2));
  long long left = -1;
  long long right = n;
  for (long long i = 0; i < (long long)(q); i++) cin >> ql[i][0] >> ql[i][1];
  for (long long i = (q - 1); i >= (0); i--) {
    if (left != -1 && s[left] == ql[i][0] && ql[i][1] == 'R')
      left--;
    else if (right != n && s[right] == ql[i][0] && ql[i][1] == 'L')
      right++;
    else if (left != n - 1 && s[left + 1] == ql[i][0] && ql[i][1] == 'L')
      left++;
    else if (right != 0 && s[right - 1] == ql[i][0] && ql[i][1] == 'R')
      right--;
  }
  cout << max(0ll, right - left - 1) << endl;
}
