#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main() {
int n,q; cin>>n>>q;
  string s; cin>>s;
  char mfor[q+1];
  char vec[q+1];
  for(int i=1;i<=q;i++){
    cin>>mfor[i]>>vec[i];}
  char masu[n+1];
  for(int i=1;i<=n;i++){
    masu[i]=s[i-1];}
  
  int pol=0;
  int por=n+1;
  int point[n+1]={0};
  for(int i=q;i>=1;i--){
    
    if(vec[i]=='L'){
      if(masu[pol+1]==mfor[i]){
        point[pol+1]=1;
      pol++;}
        if(masu[por]==mfor[i]){
          if(por<=n){point[por]=0;
                     por++;}
        }
      
    }
          
    if(vec[i]=='R'){
      if(masu[por-1]==mfor[i]){
        point[por-1]=1;
        por--;}
      if(masu[pol]==mfor[i]){
        if(pol>=1){point[pol]=0;
        pol--;}
      }
     }
          
      if(pol==por) break;
  }
  
  int cou=0;
  for(int i=1;i<=n;i++){
    if(point[i]==0)cou++;}
  
  cout<<cou<<endl;
    
  
}
