N,Q=map(int,input().split())
S=input()
TD=[input().split() for _ in [0]*Q][::-1]
#print(TD)
L=0; cli=0; escape_l=0
R=0; cri=N-1; escape_r=0
for t,d in TD:
    if cli<N and d=='L' and t==S[cli] and escape_l==0:
        L+=1; cli+=1
        next_lt=S[cli]
    if 0<cli<N and d=='R' and t==S[cli-1]:
        escape_l=1
    if cli<N and d=='R' and t==S[cri] and escape_r==0:
        R+=1; cri-=1
        next_rt=S[cri]
    if 0<cri<N and d=='L' and t==[cri-1]:
        escape_r=1
#print(L,R)
print(max(N-L+escape_l-R+escape_r,0))