n, m = [int(i) for i in input().split()]
S = input()
Q = [[i for i in input().split()] for j in range(m)]

l = 0
r = n - 1

for t, d in Q[::-1]:
    if d == 'L' and t == S[l]:
        l += 1
    elif d == 'R' and t == S[r]:
        r -= 1
    if l >= n or r < 0:
        break

print(max(0, r - l + 1))