#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<pair<char, char>> v(q);
  int l = -1, r = s.size(), lb = l, rb = r;
  for (int i = 0; i < v.size(); i++) {
    cin >> v.at(i).first >> v.at(i).second;
  }
  reverse(v.begin(), v.end());
  for (int j = 0; j < v.size(); j++) {
    if (v.at(j).second == 'R') {
      if (r - 1 >= 0 && v.at(j).first == s.at(r - 1)) {
        r--;
      }
      if (l - 1 >= 0 && v.at(j).first == s.at(l)) {
        l--;
      }
    } else {
      if (r + 1 < s.size() && v.at(j).first == s.at(r)) {
        r++;
      }
      if (l + 1 < s.size() && v.at(j).first == s.at(l + 1)) {
        l++;
      }
    }
  }
  cout << r - l - 1 << endl;
}
