N, Q = map(int, input().split())
s = str(input())
s_inv = s[::-1]
coms = [list(map(str, input().split())) for _ in range(Q)]
# 後ろから見る
coms = coms[::-1]
i = 0
j = 0
ans_1 = 0
ans_2 = 0
for com in coms:
    # Rに対する処理
    if i <= N-1:
        if i > 0:
            if com[1] == 'L' and com[0] == s_inv[i-1]:
                ans_1 = i-1
                i = 0
                continue
        if com[1] == 'R' and com[0] == s_inv[i]:
            i = i+1
            ans_1 = max(i, ans_1)
    # Lに対する処理
    if i <= N-1:
        if i > 0:
            if com[1] == 'R' and com[0] == s_inv[j-1]:
                ans_1 = j-1
                j = 0
                continue
        if com[1] == 'L' and com[0] == s[j]:
            j = j+1
            ans_2 = max(j, ans_2)
print(max(N-ans_1-ans_2, 0))