def solution(N, S, incantations):
    # 呪文を逆順に追ってはみ出る範囲を特定していく
    left, right = 0, N - 1  # [left, right] は消滅しない範囲
    for t, d in incantations[::-1]:
        if d == 'R' and S[right] == t:
            right -= 1
        if d == 'L' and S[left] == t:
            left += 1
        if left > right:
            break
    print(right - left + 1)


def main():
    N, Q = list(map(int, input().split()))
    S = input()
    incantations = [input().split() for _ in range(Q)]
    solution(N, S, incantations)


if __name__ == '__main__':
    main()