import sys

N, Q = map(int, sys.stdin.readline().split())

s = sys.stdin.readline()
golem_place = list(range(N))
golem_num = N

Q_list = []
for i in range(Q):
    Q_list.append(sys.stdin.readline().split())

delete_count = 0
# 呪文の数だけループする
left = 0
right = N
for t,d in reversed(Q_list):
    # leftの移動
    if s[left] == t:
        if d == "L":
            left += 1
    if s[right - 1] == t:
        if d == "R":
            right -= 1

print(right-left)