N, Q = map(int, input().split())
s = input()
td = []
for i in range(Q):
    td.insert(0, input().split())
#print("td = {}".format(td))

llim = 0
rlim = N - 1
for t, d in td:
    if((s[llim] == t) and ("L" == d)):
        llim += 1
    elif(llim - 1 >= 0):
        if((s[llim - 1] == t) and ("R" == d)):
            llim -= 1
    if((s[rlim] == t) and ("R" == d)):
        rlim -= 1
    elif(rlim + 1 <= N - 1):
        if((s[rlim + 1] == t) and ("L" == d)):
            rlim += 1
#    print("td = {}, llim = {}, rlim = {}".format([t, d], llim, rlim))

print(str(max(0, rlim - llim + 1)))
