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