#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
using vpl = vector<pl>;
using vvpl = vector<vpl>;
const ll MOD = 1000000007;
const ll MOD9 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const ll dy[8] = {1, 0, -1, 0, 1, 1, -1, -1};
const ll dx[8] = {0, -1, 0, 1, 1, -1, 1, -1};
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  ll n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<pair<char, char>> que(q);
  for (ll i = 0; i < q; i++) {
    cin >> que[i].first >> que[i].second;
  }
  reverse((que).begin(), (que).end());
  ;
  ll left = 0, right = n - 1;
  for (ll i = 0; i < q; i++) {
    if (que[i].second == 'L') {
      if (que[i].first == s[left]) {
        left++;
      }
    } else {
      if (que[i].first == s[right]) {
        right--;
      }
    }
  }
  cout << right - left + 1 << endl;
}
