
def nibu():
    n,q=map(int,input().split())
    s=[0]+list(input())+[0]
    td=[list(map(str,input().split()))for i in range(q)][::-1]

    L=0
    R=n+1
    
    for t,d in td:
        if t==s[L+1] and d=='L':
            L+=1
        elif t==s[L] and d=='R':
            L-=1
        
        if t==s[R-1]==d=='R':
            R-=1
        elif t==s[R] and d=='L':
            R+=1

    return max(0,R-L-1)

print(nibu())