
def solve(N, Q, S, TDs):
    f_index = -1
    l_index = N
    ans = N
    for q in TDs[::-1]:
        t, d = q
        if d == "L" and S[f_index + 1] == t:
            f_index += 1
            ans -= 1
        if d == "R" and S[l_index - 1] == t:
            l_index -= 1
            ans -= 1
    return max(0, ans)

if __name__ == "__main__":
    N, Q = tuple(map(int, input().split(" ")))
    S = input()
    TDs = [tuple(input().split(" ")) for __ in range(Q)]
    print(solve(N, Q, S, TDs))
