N,Q = map(int,input().split())
s = 'n' + input() + 'n'
mv = []
for _ in range(Q):
    mv.append(input().split())
mv.reverse()

def move(ix):
    for i in range(Q):
        if mv[i][0]==ix:
            if mv[i][1]=='L':
                ix -= 1
            else: ix += 1

            if ix == 0:
                return 'left'
            elif ix == N+1:
                return 'right'
    return 'safe'

lix,rix = 0,N+1
for i in mv:
    if lix+1 < N+1 and i[0] == s[lix +1] and i[1] == 'L':
        lix += 1
    # elif lix-1>0 and i[0] == s[lix-1] and i[1] == 'R':
    #     lix -= 1
    elif lix == 1 and i[0] == s[lix] and i[1] == 'R':
        lix = 0
    if lix == N:
        print(0)
        exit()

for i in mv:
    #print(rix-1 > 0 and i[0] == s[rix - 1] and i[1] == 'R')
    if rix-1 > 0 and i[0] == s[rix - 1] and i[1] == 'R':
        rix -= 1
    # elif rix+1<N+1 and i[0] == s[rix+1] and i[1] == 'L':
    #     rix += 1
    elif rix == N and i[0] == s[rix] and i[1] == 'L':
        rix += 1
    if rix == 0:
        print(0)
        exit()
print(-lix+rix-1)