import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, Q = lr()
S = '-' + sr() + '-'
TD = [sr().split() for _ in range(Q)]

L = 1
for t, d in TD[::-1]:
    if d == 'L':
        if L <= N and S[L] == t:
            L += 1
    if d == 'R':
        if L >= 1 and S[L-1] == t:
            L -= 1
R = N
for t, d in TD[::-1]:
    if d == 'L':
        if R <= N and S[R+1] == t:
            R += 1
    if d == 'R':
        if R >= 1 and S[R] == t:
            R -= 1

answer = max(0, R - L + 1)
print(answer)
# 34
