N,Q=map(int,input().split())
S=input()
TD=[]

for q in range(Q):
	TD.append(list(map(str,input().split())))


L=S[:]
R=S[::-1]
lw=0
rw=0
ansl = 0
ansr = 0
for q in range(Q)[::-1]:
	if TD[q][1] == 'L':
		if TD[q][0] == L[lw]:
			ansl = max(ansl, lw+1)
			lw = min(lw+1, N-1)
		if TD[q][0] == R[rw]:
			rw = 0
	if TD[q][1] == 'R':
		if TD[q][0] == R[rw]:
			ansr = max(ansr, rw+1)
			rw = min(rw+1, N-1)
		if TD[q][0] == L[lw]:
			lw = 0
print(N-(ansr+ansl))
			
