#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);
  vector<int> left, right;
  for (int i = q - 1; i >= 0; --i) {
    if (t.at(i) == s.at(0) && d.at(i) == 'L') left.push_back(0);
    if (t.at(i) == s.at(n - 1) && d.at(i) == 'R') right.push_back(n - 1);
    for (int j = 0; j < (left.size()); ++j) {
      if (left.at(j) < n && d.at(i) == 'L' && t.at(i) == s.at(left.at(j)))
        left.at(j)++;
    }
    for (int j = 0; j < (right.size()); ++j) {
      if (right.at(j) >= 0 && d.at(i) == 'R' && t.at(i) == s.at(right.at(j)))
        right.at(j)--;
    }
  }
  int ma = 0, mi = n - 1;
  for (int i = 0; i < (left.size()); ++i) ma = max(ma, left.at(i));
  for (int i = 0; i < (right.size()); ++i) mi = min(mi, right.at(i));
  if (ma >= mi)
    cout << 0 << endl;
  else
    cout << n - ma - (n - 1 - mi) << endl;
}
