N, Q = map(int, input().split())
s = input()
 
action=[]
for i in range(Q):
    t, d = input().split()
    action.append((t,d))

start = -1
end = len(s)
for ac in action[::-1]:
    t, d = ac
    
    if d=='R':
        # for start
        if s[start-1]==t and start > 0:
            start -= 1
        
        # for end
        if s[end-1]==t and end > 0:
            end -= 1
        
    elif d=='L':
        # for start
        if start < len(s)-1 and s[start+1]==t:
            start += 1
        
        # for end
        if end < len(s)-1 and s[end+1]==t:
            end += 1
if end>start:
    print((end - start)-1)
else:
    print(0)