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) & ("L" == d)):
        llim += 1
    if((s[rlim] == t) & ("R" == d)):
        rlim -= 1
#    print("td = {}, llim = {}, rlim = {}".format([t, d], llim, rlim))

if(llim > rlim):
    print("0")
else:
    print(str(rlim - llim + 1))
