N, Q = map(int, input().split())
s = input()
tq_R_list = []
tq_L_list = []
for _ in range(Q):
    t, q = input().split()
    if q == 'R':
        tq_R_list.append(t)
    else:
        tq_L_list.append(t)

tq_L_list = tq_L_list[::-1]
tq_R_list = tq_R_list[::-1]

# left
lcount = 0
for i in range(len(tq_L_list)):
    if s[lcount] == tq_L_list[i]:
        lcount += 1

# right
rcount = 0
for j in range(len(tq_R_list)):
    if s[int(N-1-rcount)] == tq_R_list[j]:
        rcount += 1


if N - lcount- rcount >= 0:
    print(N - lcount- rcount)
else:
    print(0)
