#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  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.at(i) >> d.at(i);
  int left = 0, right = n - 1;
  for (int i = q - 1; i >= 0; --i) {
    if (left < n && t.at(i) == s.at(left) && d.at(i) == 'L') left++;
    if (right >= 0 && t.at(i) == s.at(right) && d.at(i) == 'R') right--;
  }
  if (left >= right)
    cout << 0 << endl;
  else
    cout << n - left - (n - 1 - right) << endl;
}
