N,Q = map(int,input().split())
s =input()
td = []
lend = 0
rend = N-1

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[lend]:#左端を1つずらす
        lend += 1
    if j == "R" and i == s[rend]:#右端を1つずらす
        rend -= 1  
    if j == "L" and i == s[rend-1] and rend < N-1:#1つ前の位置を参照して右に戻す
        rend += 1
    if j == "R" and i == s[lend+1] and lend > 0:#1つ前の位置を参照して左に戻す
        lend -= 1
    if lend > rend:
        break
        
print(rend - lend + 1)