#include <bits/stdc++.h>
using namespace std;
long long a, b;
string s;
char t[200005], d[200005];
int main(void) {
  cin >> a >> b;
  cin >> s;
  for (int i = 0; i < b; i++) {
    cin >> t[i] >> d[i];
  }
  long long left = 0, right = a - 1;
  long long ans = a;
  long long c = 1, cc = 1;
  int prel = left, prer = right;
  for (int i = b - 1; i >= 0; i--) {
    if (s[prel] == t[i] && d[i] == 'R') {
      ans++;
      c++;
      prel--;
    }
    if (s[left] == t[i] && d[i] == 'L') {
      ans = ans - c;
      left++;
      prel = left - 1;
      c = 1;
    }
    if (s[prer] == t[i] && d[i] == 'L') {
      ans++;
      cc++;
      prer++;
    }
    if (s[right] == t[i] && d[i] == 'R') {
      ans = ans - cc;
      right--;
      prer = right + 1;
      cc = 1;
    }
  }
  cout << ans << endl;
}
