N, Q = map(int, input().split())
s = '0'+input()+'0'
magic = [input().split() for i in range(Q)]

left = 0
right = N + 1

for mag in magic[::-1]:
    t = mag[0]
    d = mag[1]
    if (d == 'L') & (t == s[left + 1]):
        left += 1
    if (d == 'R') & (t == s[right - 1]):
        right -= 1
if left > right:
    print(0)
else:
    print(right - left - 1)