import sys
input = sys.stdin.readline

N,Q=map(int,input().split())
S=input().strip()
M=[input().split() for i in range(Q)]

#逆からシミューレション

PLACE=0
flag=0

for now in range(Q-1,-1,-1):
    if M[now][0]==S[PLACE] and M[now][1]=="L":
        PLACE+=1

    if PLACE==N:
        print(0)
        sys.exit()

PLACE2=N-1

for now in range(Q-1,-1,-1):
    if M[now][0]==S[PLACE2] and M[now][1]=="R":
        PLACE2-=1

    if PLACE2==-1:
        print(0)
        sys.exit()

print(max(0,N-(PLACE+(N-1-PLACE2))))
