n, q = map(int,input().split())
s = list(input())
sunuke = [input().split() for i in range(q)]
golem = []

for i in range(n):
    golem.append([i,s[i]]) #[0 ~ n-1, letter]
    


count = 0
for i in range(q):
    for j in range(n):
        if sunuke[i][0] == golem[j][1] :
            if sunuke[i][1] == "L":
                if golem[j][0] == 0:
                    count += 1
                    golem[j][1] = "end"

                else:
                    golem[j][0] -= 1
        
            else:
                if golem[j][0] == n-1:
                    count += 1
                    golem[j][1] = "end"

                else:
                    golem[j][0] += 1
   
                    
    


answer = n - count
print(answer)
