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
for com in coms:
    # Rに対する処理
    if i <= N-1:
        if com[1] == 'R' and com[0] == s_inv[i]:
            i = i+1
    # Lに対する処理
    if j <= N-1:
        if com[1] == 'L' and com[0] == s[j]:
            j = j+1
print(max(N-i-j, 0))
