#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll, ll>;
using str = string;
using vpl4 = vector<pair<ll, ll>>;
ll MOD = 1000000007;
signed main() {
  ll(n);
  cin >> (n);
  ;
  ll(q);
  cin >> (q);
  ;
  str(s);
  cin >> (s);
  ;
  str t;
  str d;
  for (ll i = 0; i <= q - 1; i++) {
    cin >> t[i] >> d[i];
  }
  ll l = 0;
  ll r = n - 1;
  for (ll i = q - 1; i >= 0; i--) {
    if (d[i] == 'L') {
      if (t[i] == s[l]) {
        if (l < n - 1) l++;
      }
    } else {
      if (t[i] == s[r]) {
        if (r > 0) r--;
      }
    }
  }
  cout << (r < l ? 0 : r - l + 1) << endl;
  ;
}
