import string

n, q = map(int, input().split())
s = input()
tds = list(tuple(input().split()) for _ in range(q))

left = 0
right = n-1

for t, d in reversed(tds):
    if d=="L":
        if t==s[left]:
            left = min(left+1, n-1)
    if d=="R":
        if t==s[right]:
            right = max(right-1, 0)

print(right - left + 1)
