N, Q = map(int, input().split())
s = input()
tds = [input().split() for _ in range(Q)]

barely_safe_left = 0
barely_safe_right = N - 1
for t, d in reversed(tds):
    if barely_safe_left >= N or barely_safe_right < 0:
        break
    if s[barely_safe_left] == t and d == 'L':
        barely_safe_left += 1
    if s[barely_safe_right] == t and d == 'R':
        barely_safe_right -= 1

if barely_safe_left > barely_safe_right:
    print(0)
else:
    print(barely_safe_right - barely_safe_left + 1)
    