import re

N, Q = [int(item) for item in re.split(r"\s", input())]
s = input()
t = []
d = []
for _ in range(Q):
    t_in, d_in = [item for item in re.split(r"\s", input())]
    t.append(t_in)
    d.append(d_in)

l_most = -1
r_most = N

for q in range(Q-1, -1, -1):
    # find last s[0], L
    if t[q] == s[0] and d[q] == "L":
        l_most = 0

        for i in range(q-1, -1, -1):
            look_r = l_most+1
            if look_r <= N-1 and s[look_r] == t[i] and d[i] == "L":
                l_most = look_r

        break


for q in range(Q-1, -1, -1):
    # find last s[N-1], R
    if t[q] == s[N-1] and d[q] == "R":
        r_most = N-1

        for i in range(q-1, -1, -1):
            look_l = r_most-1
            # look_r = l_most+1
            if look_l >= 0 and s[look_l] == t[i] and d[i] == "R":
                r_most = look_l
            # elif look_r <= N-1 and s[look_r] == t[i] and d[i] == "L":
            #    r_most = look_r

        break
if r_most > l_most:
    print(r_most-l_most-1)
else:
    print(0)
