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

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

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