#a,b,c = [int(i) for i in input().split()]

import sys
input = sys.stdin.readline

n,q = [int(i) for i in input().split()]
s=input()
td = [[i for i in input().split()] for _ in [0]*q]
td=td[::-1]

#print(n,q,td)

l=-1; r=n
for t,d in td:
    if d=="L":
        if l==n-1: continue
        moji=s[l+1]
        if moji == t:
            l+=1

    if d=="R":
        if r==0: continue
        moji=s[r-1]
        if moji == t:
            r-=1
    
#    print(l,r)
if l < r:
    print(n-(l+1)-(n-r))
else:
    print(0)


        