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

p = 0
q = N-1
for i in range(Q-1,-1,-1):
    x = ju[i]
    if x[0] == s[p]:
        if x[1] == 'L':
            p += 1
    if x[0] == s[q]:
        if x[1] == 'R':
            q -= 1
    if p < 0: p = 1
    if q > N-1: q = N-1
    if q < p:
        print("0")
        exit()
print(q-p+1)
