#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long double EPS = 1e-10;
const int dyx[4][2] = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}};
int extincted[200000];
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<pair<char, char> > queries(q);
  char t, d;
  for (int i = 0; i < q; ++i) {
    cin >> queries[i].second >> queries[i].first;
  }
  int si = 0, max_si = 0, ans = n;
  for (int i = q - 1; i >= 0; --i) {
    if (si < n && queries[i].first == 'L' && queries[i].second == s[si]) {
      ++si;
      max_si = max(si, max_si);
    } else if (si >= 1 && queries[i].first == 'R' &&
               queries[i].second == s[si - 1]) {
      --si;
    }
  }
  ans -= max_si;
  si = n - 1;
  int min_si = n - 1;
  for (int i = q - 1; i >= 0; --i) {
    if (si >= 0 && queries[i].first == 'R' && queries[i].second == s[si]) {
      --si;
      min_si = min(si, min_si);
    } else if (si < n - 1 && queries[i].first == 'L' &&
               queries[i].second == s[si + 1]) {
      ++si;
    }
  }
  ans -= n - 1 - min_si;
  cout << max(0, ans) << endl;
}
