#include <bits/stdc++.h>
using namespace std;

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

struct Data {
	char t, d;
};

int main()
{
	LL N, Q;
	cin >> N >> Q;

	string S;
	cin >> S;

	vector<int> isOuts(N, 0);

	vector<Data> qs(Q);

	REP(i, Q) {
		cin >> qs[i].t >> qs[i].d;
	}
	
	int left = 0;
	int right = N - 1;

	REP(ri, Q) {
		int i = Q - 1 - ri;

		if (qs[i].d == 'L') {
			if (S[left] == qs[i].t) {
				left++;
			}

			if (right + 1 < N && S[right + 1] == qs[i].t) {
				right++;
			}
		}
		if (qs[i].d == 'R') {
			if (S[right] == qs[i].t) {
				right--;
			}

			if (left - 1 >= 0 && S[left - 1] == qs[i].t) {
				left--;
			}
		}
	}

	int total = right - left + 1;
	if (total < 0) {
		total = 0;
	}

	cout << total << endl;

	return 0;
}
