#include <bits/stdc++.h>
using namespace std;
int main() {
  int num_box, num_spell;
  cin >> num_box >> num_spell;
  string box_letter;
  cin >> box_letter;
  vector<pair<char, char>> spell(num_spell);
  for (int i = 0; i < num_spell; i++) {
    cin >> spell[i].first;
    cin >> spell[i].second;
  }
  int count = 0;
  int idx = num_box - 1;
  for (int i = 0; i < num_spell; i++) {
    if (spell[num_spell - i - 1].first == box_letter[idx] &&
        spell[num_spell - i - 1].second == 'R') {
      idx--;
      count++;
    }
  }
  idx = 0;
  for (int i = 0; i < num_spell; i++) {
    if (spell[num_spell - i - 1].first == box_letter[idx] &&
        spell[num_spell - i - 1].second == 'L') {
      idx++;
      count++;
    }
  }
  cout << num_box - count;
  return 0;
}
