#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long MOD = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  s = "?" + s + "?";
  string t(Q, ' '), d(Q, ' ');
  for (int i = 0; (i) < (Q); ++(i)) {
    cin >> t[i] >> d[i];
  }
  int ans = N;
  int low = 0, high = N;
  while (high - low > 1) {
    int mid = (high + low) / 2;
    int cur = mid;
    bool exist = true;
    for (int i = 0; (i) < (Q); ++(i)) {
      if (s[cur] == t[i]) {
        cur += 2 * (d[i] == 'R') - 1;
        if (cur == 0) {
          exist = false;
          break;
        }
      }
    }
    if (exist) {
      high = mid;
    } else {
      low = mid;
    }
  }
  ans -= low;
  low = 0, high = N + 1;
  while (high - low > 1) {
    int mid = (high + low) / 2;
    int cur = mid;
    bool exist = true;
    for (int i = 0; (i) < (Q); ++(i)) {
      if (s[cur] == t[i]) {
        cur += 2 * (d[i] == 'R') - 1;
        if (cur == N + 1) {
          exist = false;
          break;
        }
      }
    }
    if (exist) {
      low = mid;
    } else {
      high = mid;
    }
  }
  ans -= N - low;
  cout << ans << endl;
  return 0;
}
