#include <bits/stdc++.h>
using namespace std;
const int INF = 200;
const long long LINF = 1001001001001001001;
const int MOD = 1e9 + 7;
int N = 0;
int Q = 0;
string str;
char cell[INF];
int ret = 0;
char dp[INF][INF];
vector<char> t;
vector<char> d;
char canStay(int n, int q) {
  if (dp[n][q] != -1) {
    return dp[n][q];
  } else if (q == Q) {
    return 1;
  } else {
    int now = n;
    if (t[q + 1] == cell[n]) {
      if (d[q + 1] == 'L') {
        now--;
      } else if (d[q + 1] == 'R') {
        now++;
      } else {
        cerr << ("WRONG") << " ";
      }
      if (now == 0 || now == N + 1) {
        dp[n][q] = 0;
        return 0;
      } else {
        char ans = canStay(now, q + 1);
        dp[n][q] = ans;
        return ans;
      }
    } else {
      char ans = canStay(n, q + 1);
      dp[n][q] = ans;
      return ans;
    }
  }
}
void input() {
  cin >> N;
  cin >> Q;
  cin >> str;
  for (int i = 0; i < (N); i++) {
    cell[i + 1] = str[i];
  }
  t.push_back('b');
  d.push_back('b');
  for (int i = 0; i < (Q); i++) {
    char c;
    char dir;
    cin >> c;
    cin >> dir;
    t.push_back(c);
    d.push_back(dir);
  }
  for (int i = 0; i < (N + 3); i++) {
    for (int j = 0; j < (Q + 3); j++) {
      dp[i][j] = -1;
    }
  }
}
void solve() {
  for (int i = 0; i < (N); i++) {
    char ans = canStay(i + 1, 0);
    if (ans == 1) {
      ret++;
    }
  }
}
int main(void) {
  input();
  solve();
  cout << (ret) << endl;
}
