n,q=map(int,input().split())
s="0"+input()+"0"
a=[list(input().split())for i in range(q)]
l=0
r=n+1
for i in range(q-1,-1,-1):
    t,d=a[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(max(0,r-l-1))