#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<(n);i++)
using namespace std;
char x[200000],y[200000];
signed main(){
	int a,b,c,d;
	string s;
	cin>>a>>b>>s;
	c=-1,d=a;
	f(i,b){
		cin>>x[i]>>y[i];
	}
	for(int i=b-1;i>=0;i--){
		if(x[i]==s[c+1]&&y[i]=='L')c++;
		if(x[i]==s[d-1]&&y[i]=='R')d--;
		if(x[i]==s[c]&&y[i]=='R')c--;
		if(x[i]==s[d]&&y[i]=='L')d++;
	}
	cout<<max((int)(0),d-c-1)<<endl;
    return 0;
}