N, Q = map(int, input().split())
s = str(input())
coms = [list(map(str, input().split())) for _ in range(Q)]


def isOK(A, index, coms, c):
    # シミュレーションを行う
    for com in coms:
        if com[0] != A[index]:
            continue
        else:
            if com[1] == 'R':
                if index == len(A)-1:
                    return c == 'R'
                index += 1
            elif com[1] == 'L':
                if index == 0:
                    return c == 'L'
                index -= 1
    return False


def lower_bound(A, coms):
    ng = -1
    ok = len(A)

    while(abs(ok-ng) > 1):
        mid = (ok + ng) // 2

        if isOK(A, mid, coms, 'R'):
            ok = mid
        else:
            ng = mid
    return ok


def upper_bound(A, coms):
    ng = len(A)
    ok = -1

    while(abs(ok-ng) > 1):
        mid = (ok + ng) // 2

        if isOK(A, mid, coms, 'L'):
            ok = mid
        else:
            ng = mid
    return ok


lower = lower_bound(s, coms)
upper = upper_bound(s, coms)
print(lower-upper-1)