#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <deque>

using namespace std;

int main() {
	int n, q;
	string s;
	cin >> n >> q >> s;

	vector<char> t(q), d(q);
	for (int i = 0; i < q; i++) {
		cin >> t[i] >> d[i];
	}

	s = string("?") + s + string("?");
	int idx_l = 1;
	int idx_r = n;

	for (int i = q - 1; i >= 0; i--) {
		char c = t[i];
		if (d[i] == 'L') {
			if (s[idx_l] == c) {
				idx_l++;
			}
			if (s[idx_r + 1] == c) {
				idx_r++;
			}
		} else {
			if (s[idx_r] == c) {
				idx_r--;
			}
			if (s[idx_l - 1] == c) {
				idx_l--;
			}
		}

		if (idx_l > idx_r) {
			break;
		}
	}

	int ans = idx_r - idx_l + 1;
	cout << ans << endl;

	return 0;
}
