n,q = list(map(int,input().split()))
s = str(input())

t =[]
d = []
for i in range(q):
    t_,d_ = list(map(str,input().split()))
    t.append(t_)
    d.append(d_)

ind = -1
for i in range(q-1,-1,-1):
    if t[i]==s[ind]:
        if d[i]=='L':
            if ind<=n-1
            ind+=1
        if d[i]=='R':
            if ind>=0:
                ind-=1

ind_ = n
for i in range(q-1,-1,-1):
    if t[i]==s[ind]:
        if d[i]=='L':
            if ind<=n-1
            ind+=1
        if d[i]=='R':
            if ind>=0:
                ind-=1
                
if ind>=ind_-1:
    print(0)
else:
    print(ind_-ind-1)