n,q = (int(i) for i in input().split())
s = input()
x = [[i for i in input().split()] for i in range(q)]
l,r,s = 0,n+1,"#"+s+"#"
for i,j in x[::-1]:
    if l<=n and s[l+1]==i and  j=="L": l+=1
    elif s[l]==i and j=="R": l-=1
    if s[r-1]==i and j=="R": r-=1
    elif s[r]==i and j=="L": r+=1
print(max(0,r-l-1))