N,Q = map(int,input().split(" "))
s=list(input())
ju = []
for i in range(Q):
    ju.append(input().split(" "))

p = 0
pd = False
q = N-1
qd = False
for i in range(Q-1,-1,-1):
    x = ju[i]
    if p > N-1: break
    if not pd:
        if x[0] == s[p] and x[1] == 'L':
            pd = True
    else:
        if p < N-1 and x[0] == s[p+1] and x[1] == 'L':
            p += 1
    #print('p', p)

for i in range(Q-1,-1,-1):
    x = ju[i]
    if q < 0: break
    if not qd:
        if x[0] == s[q] and x[1] == 'R':
            qd = True
    else:
        if q > 1 and x[0] == s[q-1] and x[1] == 'R':
            q -= 1
    #print('q', q)
#print(pd,qd)

if p > q:
    print(0)
else:
    c = sum([pd,qd])
    print(q-p+1-c)
