import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
s = list(input())

t, d = [0] * Q, [0] * Q
for i in range(Q):
    td = input().split()
    t[i], d[i] = td[0], 2 * int(td[1] == 'R') - 1

l_a, l_b = 0, min(Q, N)
r_a, r_b = N - min(Q, N), N

while True:
    # print("#", (l_a, l_b), (r_a, r_b))
    if r_b < l_b:
        break
    elif l_a < l_b:
        m = l_a + (l_b - l_a) // 2
    elif r_a < r_b:
        m = r_b - (r_b - r_a) // 2
    else:
        break # !!!
    #
    pos = m
    for i in range(Q):
        ti, di = t[i], d[i]
        # print("##", Q - i, pos, N - Q + i)
        if Q - i < pos < N - Q + i:
            break
        elif s[pos] == ti:
            pos += di
            if pos < 0 or N <= pos: break
    #
    if pos < 0:
        l_a = max(l_a, m + 1)
        r_a = max(r_a, m + 1)
    elif N <= pos:
        l_b = min(l_b, m - 1) # oh...
        r_b = min(r_b, m - 1)
    else:
        l_b = min(l_b, m)
        r_a = max(r_a, m)

print(max(0, r_b - l_a + 1))