n, q = map(int, input().split())
board = input()
spells = []
left_golem = 0

for i in range(q):
    spells.append(input().split())

for now in range(n):
    for spell in spells:
        if spell[0] == board[now]:
            now = now + 1 if spell[1] == 'R' else now - 1
            if not 0 <= now < len(board):
                break
    else:
        left_golem += 1
        
print(left_golem)