n,q = map(int,input().split())
s = list(input())
data = []
for i in range(q):
    t,d = input().split()
    data.append([t,d])

data.reverse()
lcount = 0
rcount = 0 #右から落ちる
k = 0 #右から調べる 落ちた個数を表す
for i in range(q):
    if data[i][0] == s[-k-1] and data[i][1] == "R":
        rcount += 1
        k += 1
    if k == n:
        break
j = 0 #左から調べる
for i in range(q):
    if data[i][0] == s[j] and data[i][1] == "L":
        lcount += 1
        j += 1
    if j == n:
        break

if j+k > n:
    drop = rcount + lcount - (j+k-n)
else:
    drop = rcount + lcount

print(n-drop)