#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

    int N, Q;
    string S;
    char T[200000], D[200000];
    cin >> N >> Q >> S;

    for(int i = 0; i < Q; i++) cin >> T[i] >> D[i];

	int L = 0;
	int R = N;
	for(int i = Q - 1; i >= 0; i--){
		if (R > 0 && D[i] == 'R' && S[R - 1] == T[i]) R--;
		else if (R < N && D[i] == 'L' && S[R] == T[i]) R++;
		if (L > 0 && D[i] == 'R' && S[L - 1] == T[i]) L--;
		else if (L < N && D[i] == 'L' && S[L] == T[i]) L++;
	}

	cout << R - L << endl;

	return 0;
}
