n,q = list(map(int,input().split()))
s = input()

td = []
revtd = []
lMarker = -1
rMarker = n

rawTD = []
for i in range(q):
    rawTD.insert(0,input())

for i in rawTD:
    inp = i.split()
    revDict = -1 if inp[1] == "R" else 1
    posS = [i + (revDict * -1) for i, x in enumerate(s) if x == inp[0]]
    for j in posS:
        if j == lMarker:
            lMarker += revDict
        if j == rMarker:
            rMarker += revDict
# print(rMarker)
print(rMarker - (lMarker + 1))
