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

t = [0]*Q
d = [0]*Q
for q in range(Q):
    t[q],d[q] = map(str, input().split())


s1 = 0
sN = N-1

for q in reversed(range(Q)):
    if t[q] == S[s1]:
        if d[q] == 'L':
            s1 += 1
    if t[q] == S[sN]:
        if d[q] == 'R':
            sN -= 1
    #print(s1,sN)


print(sN-s1+1)