n,q=list(map(int,input().split()))
s="0"+input()+"0"
t,d=[],[]
for i in range(q):
    ti,di=input().split()
    t.append(ti)
    d.append(di)
lsafeline,rsafeline=1,n
for i in range(q-1,-1,-1):
    if d[i]=="R":
        if s[rsafeline]==t[i] and rsafeline!=1:rsafeline-=1
        if s[lsafeline]==t[i] and lsafeline!=1:lsafeline-=1
    else:
        if s[rsafeline]==t[i] and rsafeline!=n:rsafeline+=1
        if s[lsafeline]==t[i] and lsafeline!=n:lsafeline+=1
print(rsafeline-lsafeline+1)