#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);
  ;
  vector<pair<char, char>> d(q);
  for (ll i = 0; i <= q - 1; i++) {
    cin >> d[i].first >> d[i].second;
  }
  ll l = 0;
  ll r = n - 1;
  for (ll i = q - 1; i >= 0; i--) {
    if (l < n - 1 && s[l] == d[i].first && d[i].second == 'L') l++;
    if (r > 0 && s[r] == d[i].first && d[i].second == 'R') r--;
    if (l > 0 && s[l - 1] == d[i].first && d[i].second == 'R') l--;
    if (r < n - 1 && s[r + 1] == d[i].first && d[i].second == 'L') r++;
  }
  cout << (r - l + 1) << endl;
  ;
}
