#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<pair<char, char>> td;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    td.emplace_back(t, d);
  }
  vector<bool> fall(n);
  int L = -1, R = n;
  for (int i = q - 1; i >= 0; i--) {
    char t = td[i].first, d = td[i].second;
    if (d == 'L') {
      if (L + 1 < n && s[L + 1] == t) {
        fall[L + 1] = true;
        L++;
      }
    } else {
      if (R - 1 >= 0 && s[R - 1] == t) {
        fall[R - 1] = true;
        R--;
      }
    }
  }
  int ans = 0;
  for (auto&& b : fall) {
    if (!b) ans++;
  }
  cout << ans << endl;
}
