N,Q=map(int, input().split())
s=input()
td=[input().split() for i in range(Q)]

l=0
r=len(s)-1
for spell in reversed(td):
    if spell[0]==s[l] and spell[1]=='L':
        l+=1
    elif spell[0]==s[r] and spell[1]=='R':
        r-=1
print(max(0,r-l+1))
