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