n,q = list(map(int,input().split()))
s = input()
td = []
revtd = []
for i in range(q):
    inp = input().split()
    td.append({
        "t":inp[0],
        "d":inp[1]
    })
    revDict = -1 if inp[1] == "R" else 1
    posS = [i + (revDict * -1) for i, x in enumerate(s) if x == inp[0]]
    revtd.insert(0,{"t":posS,"d":revDict})
# print(revtd)

# 左に落ちるゴーレム
lMarker = -1
for i in revtd:
    for j in i.get("t"):
        if j == lMarker:
            lMarker += i.get("d")
# print(lMarker)
# 右に落ちるゴーレム
rMarker = n
for i in revtd:
    for j in i.get("t"):
        if j == rMarker:
            rMarker += i.get("d")
# print(rMarker)
print(rMarker - (lMarker + 1))
