N, Q = map(int, input().split())
s = input()
td = [list( input().split()) for _ in range(Q)]

td.reverse()
left = 0
right = N - 1

for a in td:
    if a[1] == 'L':
        if a[0] == s[left]:
            left += 1
    else:
        if a[0] == s[right]:
            right -= 1
    if left > right:
        break

print(right - left + 1)
