#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 lb = -1, rb = s.size();
  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 (rb - 1 >= 0 && v.at(j).first == s.at(rb - 1)) {
        rb--;
      } else if (rb + 1 < v.size() && v.at(j).first == s.at(rb + 1)) {
        rb++;
      }
    } else if (lb + 1 < s.size() && v.at(j).first == s.at(lb + 1)) {
      lb++;
    } else if (lb - 1 >= 0 && v.at(j).first == s.at(lb - 1)) {
      lb--;
    }
  }
  cout << rb - lb - 1 << endl;
}
