n,q = map(int,input().split())
s = list(input())
data = []
for i in range(q):
    t,d = input().split()
    data.append([t,d])

data.reverse()
lcount = 0
rcount = 0 #右から落ちた個数
right = n-1
left = 0
for i in range(q):
    if right < left:
        break
    if data[i][0] == s[right] and data[i][1] == "R":
        right -= 1
        rcount += 1
    elif data[i][0] == s[left] and data[i][1] == "L":
        left += 1
        lcount += 1

print(n-lcount-rcount)