#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
char x[200000],y[200000];
signed main(){
	int a,b,c=-1,d;
	string s;
	cin>>a>>b>>s;
	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;
}
