#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
template <typename T>
void vprint(T &V) {
  for (auto v : V) {
    cout << v << " ";
  }
  cout << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<pair<char, char> > queries;
  for (long long i = (0); i < (Q); ++i) {
    char t, d;
    cin >> t >> d;
    auto p = make_pair(t, d);
    queries.push_back(p);
  }
  reverse((queries).begin(), (queries).end());
  long long left_death = -1;
  long long right_death = N;
  for (auto p : queries) {
    char t = p.first;
    char d = p.second;
    if (d == 'R') {
      if (s[right_death - 1] == t) {
        right_death--;
      }
    } else {
      if (s[left_death + 1] == t) {
        left_death++;
      }
    }
  }
  long long diff = right_death - left_death;
  if (diff > 0) {
    cout << (diff - 1) << endl;
  } else {
    cout << (0) << endl;
  }
  return 0;
}
