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

edge = [0,N-1]	
	
for i in range(Q):
	if t_d[Q - 1 - i][1] == "L":
		if t_d[Q - 1 - i][0] == s[edge[0]]:
			edge[0] += 1
	else:
		if t_d[Q - 1 - i][0] == s[edge[1]]:
			edge[1] -= 1

dif = edge[1] - edge[0]

print(dif + 1)