n, q = map(int, input().split())
S = list(input())
L = []
for i in range(q):
    t, d = input().split()
    L.append([t, d])
    
l = 0
r = n-1
for i in range(q-1, -1, -1):
    t, d = L[i]
    if t == S[l] and d == "L":
        l += 1
    elif t == S[r] and d == "R":
        r -= 1

print(max(r-l+1, 0))