import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
s = input().rstrip()
queries = [tuple(input().rstrip().split()) for _ in range(Q)]
l, r = -1, N
lm, rm = -1, N
for t, d in queries[::-1]:
    if d == 'R' and l > 0 and s[l-1] == t:
        l -= 1
    if d == 'L' and l < N - 1 and s[l+1] == t:
        l += 1
    if d == 'R' and r > 0 and s[r-1] == t:
        r -= 1
    if d == 'L' and r < N - 1 and s[r+1] == t:
        r += 1
    lm = max(lm, l)
    rm = min(rm, r)
ans = rm - lm - 1
print(ans)