#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  int N,Q;cin>>N>>Q;
  string s;cin>>s;
  std::vector<char> t(Q),d(Q);
  for(int i=0;i<Q;i++)cin>>t[i]>>d[i];

  int now=0;
  for(int i=Q-1;i>=0;i--){
    if(t[i]==s[now]&&d[i]=='L')now++;
    if(now==0)continue;
    if(t[i]==s[now-1]&&d[i]=='R')now--;
  }

  int now2=N-1;
  for(int i=Q-1;i>=0;i--){
    if(t[i]==s[now2]&&d[i]=='R')now2--;
    if(now2==N-1)continue;
    if(t[i]==s[now2+1]&&d[i]=='L')now2++;
  }



  cout<<max(0LL,now2-now+1)<<endl;
}
