N,Q = map(int,input().split())
s = ["LE"] + list(input()) + ["RE"]
td = []
lend = 1
rend = N
for i in range(Q):
    t,d = map(str,input().split())
    td.append([t,d])
td = td[::-1]
for i,j in td:
    if (j == "L")and(i == s[rend+1]):#1つ前の位置を参照して右に戻す
        rend += 1
    elif (j == "L")and(i == s[lend]):#左端を1つずらす
        lend += 1
    elif (j == "R")and(i == s[rend]):#右端を1つずらす
        rend -= 1  
    elif (j == "R")and(i == s[lend-1]):#1つ前の位置を参照して左に戻す
        lend -= 1
    elif (lend == rend -1):
        break
print(rend - lend + 1)