n, q = map(int, input().split())
s = input()
l = 0
r = n - 1
Q = [(input().split()) for i in range(q)]
Q.reverse()
for t,d in Q:
    if s[l] == t and d == "L":
        l += 1
    elif l > 0 and s[l - 1] == t and d == "R":
        l -= 1
    if s[r] == t and d == "R":
        r -= 1
    elif r < n - 1 and s[r + 1] == t and d == "L":
        r += 1
    if l > r:
        break
print(r - l + 1)
