def main():
    N, Q = map(int, input().split())
    s = input()
    command = [None] * Q
    for i in range(Q):
        t, d = input().split()
        command[i] = (t, d)
    left = -1
    right = N
    for c in list(reversed(command)):
        t, d = c
        if d == "L":
            if left < N-1 and t == s[left+1]:
                left += 1
            if right < N and t == s[right]:
                right += 1
        if d == "R":
            if right > 0 and t == s[right-1]:
                right -= 1
            if left >= 0 and t == s[left]:
                left -= 1
    print(max((right-1) - (left+1)+1, 0))


if __name__ == "__main__":
    main()
