n, q = [int(i) for i in input().split()]
s = input()
td = reversed([input().split() for _ in range(q)])

l = 0
r = n - 1
for t, d in td:
    if d == "L":
        if s[l] == t:
            l = min(l + 1, n)

        if r + 1 < n and s[r + 1] == t:
            r = min(r + 1, n)
    else:
        if 0 < l and s[l - 1] == t:
            l = max(0, l - 1)

        if s[r] == t:
            r = max(0, r - 1)


'''
    if s[l] == t:
        if d == "L":
            l += 1
        else:
            l -= 1
        l = max(0, min(n - 1, l))
    if s[r] == t:
        if d == "L":
            r += 1
        else:
            r -= 1
        r = max(0, min(n - 1, r))
'''
print(max(0, r-l+1))
