#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  int count[N + 2];
  int s[N];
  for (int i = 0; i < N; i++) {
    count[i + 1] = 1;
    cin >> s[i];
  }
  count[0] = 0;
  count[N + 1] = 0;
  char t[Q], d[Q];
  for (int j = 0; j < Q; j++) {
    cin >> t[j] >> d[j];
  }
  int z = Q;
  for (int j = 0; j < Q; j++) {
    if (N >= Q) {
      for (int l = 0; l < z; l++) {
        if (s[l] == t[j]) {
          if (d[j] == 'R') {
            count[l + 2] += count[l + 1];
            count[l + 1] = 0;
          } else {
            count[l] += count[l + 1];
            count[l + 1] = 0;
          }
        }
      }
      z -= 1;
    } else {
      while (N < Q) {
        z = N;
        for (int l = 0; l < z; l++) {
          if (s[l] == t[j]) {
            if (d[j] == 'R') {
              count[l + 2] += count[l + 1];
              count[l + 1] = 0;
            } else {
              count[l] += count[l + 1];
              count[l + 1] = 0;
            }
          }
        }
      }
      for (int l = 0; l < z; l++) {
        if (s[l] == t[j]) {
          if (d[j] == 'R') {
            count[l + 2] += count[l + 1];
            count[l + 1] = 0;
          } else {
            count[l] += count[l + 1];
            count[l + 1] = 0;
          }
        }
      }
      z -= 1;
    }
  }
  cout << N - count[0] - count[N + 1] << endl;
  return 0;
}
