#include <bits/stdc++.h>
using namespace std;
#define int long long
#define END getchar();getchar();return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef pair<int, int> P;
char t[250000], d[250000];

signed main() {
	int n, q, ans = 0;
	cin >> n >> q;
	string s;
	cin >> s;
	for (int i = 0; i < q; i++) {
		cin >> t[i] >> d[i];
	}
	int a = s.size() - 1;
	for (int i = q - 1; i >= 0; i--) {
		if (d[i] == 'R'&&s[a]==t[i]){
			ans++;
			a--;
		}
		if (ans&&d[i] == 'L'&&t[i] == s[a+1]){
			ans--;
			a++;
		}
	}
	a = 0;
	n -= ans;
	ans = 0;
	for (int i = q - 1; i >= 0; i--) {
		if (d[i] == 'L'&&s[a]==t[i]){
			ans++;
			a++;
		}
		if (ans&&d[i] == 'R'&&t[i] == s[a-1]){
			ans--;
			a--;
		}
	}
	cout << n - ans << endl;

	END; 
}
