#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << (a) << endl;
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << " ";
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << " ";
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << " ";
  pr(b, c, d);
}
int main(void) {
  int n, q;
  cin >> n >> q;
  vector<pair<char, int> > s(n);
  for (int i = 0; i < int(n); ++i) {
    char si;
    cin >> si;
    s[i] = make_pair(si, i + 1);
  }
  vector<char> ti(n), di(n);
  for (int i = 0; i < int(q); ++i) {
    cin >> ti[i] >> di[i];
  }
  for (int i = 0; i < int(q); ++i) {
    for (int j = 0; j < int(n); ++j) {
      if (s[j].first == ti[i] && s[j].second > 0) {
        int v = s[j].second;
        for (int k = 0; k < int(n); ++k) {
          if (s[k].second == v) {
            if (di[i] == 'L')
              s[k].second--;
            else
              s[k].second++;
          }
          if (s[k].second == 0 || s[k].second == n + 1) s[k].second = -1;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < int(n); ++i) {
    if (s[i].second > 0 && s[i].second < n + 1) ans++;
  }
  pr(ans);
}
