import string

alphabets = string.ascii_uppercase

N, Q = map(int, input().split())
S = input()
td = [list(input().split()) for _ in range(Q)]

pos = [0, len(S) + 1]
ds = {"L": 1, "R": -1}
res = 0

for t, d in td[::-1]:
    left, right = pos

    if (
        d == "L"
        and left + ds[d] >= 1
        and left + ds[d] <= N
        and t == S[left + ds[d] - 1]
    ):
        res += 1
        left += ds[d]
    if (
        d == "R"
        and right + ds[d] >= 1
        and right + ds[d] <= N
        and t == S[right + ds[d] - 1]
    ):
        res += 1
        right += ds[d]
    pos[0] = left
    pos[1] = right

print(N - res)
