N, Q = map(int, input().split())
S = input()
TD = reversed([tuple((input().split())) for _ in range(Q)])

left, right = 0, N-1

for t, d in TD:
	if S[left] == t and "L" == d:
		left += 1
	if S[right] == t and "R" == d:
		right -= 1
print(right-left+1)
