N,Q=map(int,input().split())
s="0"+input()+"0"
queri=[input().split() for i in range(Q)]
 
L,R=0,N+1
for i in range(Q-1,-1,-1):
    t,d=queri[i]
    if t==s[L] and d=="R":
        L-=1
    elif t==s[L+1] and d=="L":
        L+=1
    if t==s[R] and d=="L":
        R+=1
    elif t==s[R-1] and d=="R":
        R-=1
 
print(R-L-1)