#include <bits/stdc++.h>
long long const MOD = 1e9 + 7;
long long const INF = 1e18;
using namespace std;
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<pair<char, char>> v(q);
  for (auto& i : v) {
    cin >> i.first >> i.second;
  }
  int ans = n;
  int left = -1, right = n;
  for (int(i) = (q)-1; (i) >= 0; (i)--) {
    if (v[i].second == 'L' && s[left + 1] == v[i].first) {
      ans--;
      left++;
    }
    if (v[i].second == 'R' && s[right - 1] == v[i].first) {
      ans--;
      right--;
    }
  }
  cout << ans << endl;
  return 0;
}
