from collections import defaultdict

N, Q = map(int, input().split())
s = input()

left = 0
right = N - 1

e = [input().split() for _ in range(Q)]
# t: 文字 <- siと比較
# d: 'L', 'R'

dt = [None for _ in range(Q + 1)]

tmp = defaultdict(int)
for i, (t, d) in enumerate(e, 1):
    tmp[t + d] += 1
    dt[i] = tmp.copy()
# print(dt)
dt[0] = defaultdict(int)

b = [1 for _ in range(N)]
# e = e[::-1]
# print(e)
for i in sorted(range(1, Q + 1),reverse=True):
    t, d = e[i-1]
    td = t + d
    if td == s[left] + 'L':
        if left + 1 == N - 1 or dt[i - 1][s[left] + 'R'] <= dt[i - 1][s[left + 1] + 'L']:
            b[left] = 0
            left += 1
            # print(td, b)
        else:
            break

for i in sorted(range(1, Q + 1),reverse=True):
    t, d = e[i-1]

    td = t + d
    if td == s[right] + 'R':
        if right - 1 == 0 or dt[i - 1][s[right] + 'L'] <= dt[i - 1][s[right - 1] + 'R']:
            b[right] = 0
            right -= 1
        else:
            break

# print(b)
print(sum(b))
