N, Q = tuple(map(int, input().strip().split(' ')))

s = input()

if 2 * Q < N:
    s = s[:Q] + s[-1 * Q:]

origin_n = N
N = len(s)

commands = [
    tuple(input().strip().split(' '))
    for _ in range(Q)
]
min_i = -1
c_min_i = -1
max_i = N
c_max_i = N
for t, c in commands[::-1]:
    if c_min_i + 1 <= N - 1 and c == 'L' and s[c_min_i + 1] == t:
        c_min_i += 1
    if c_max_i + 1 <= N - 1 and c == 'L' and s[c_max_i + 1] == t:
        c_max_i += 1
    if c_min_i - 1 >= 0 and c == 'R' and s[c_min_i - 1] == t:
        c_min_i -= 1
    if c_max_i - 1 >= 0 and c == 'R' and s[c_max_i - 1] == t:
        c_max_i -= 1
    min_i = max(min_i, c_min_i)
    max_i = min(max_i, c_max_i)

    if c_max_i - c_min_i == 1:
        break

num_upper_disappear = N - max_i
num_lower_disappear = min_i + 1

print(origin_n - num_upper_disappear - num_lower_disappear)
