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

left, right = 0, N-1
for t, d in spell:
    if S[left] == t and d == 'L':
        left += 1
    elif 0 < left and S[left - 1] == t and d == 'R':
        left -= 1
    if S[right] == t and d == 'R':
        right -= 1
    elif right < N - 1 and S[right + 1] == t and d == 'L':
        right += 1

print(max(right - left + 1, 0))
