N, Q = map(int, input().split())
s = input()
magic = [input().split() for i in range(Q)]
dictionary = dict(zip(list(range(-1, N+1)), [0] + [1] * N + [0] ))

def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x ==x ]

for mag in magic:
    t = mag[0]
    d = mag[1]
    golems = my_index_multi(s, t)
    for golem in golems:
        if dictionary[golem] == 0:
            continue
        else:
            if d == 'R':
                dictionary[golem + 1] += dictionary[golem]
                dictionary[golem] = 0
            if d == 'L':
                dictionary[golem - 1] += dictionary[golem]
                dictionary[golem] = 0
answer = 0
for i in range(N):
    answer += dictionary[i]
print(answer)