# encoding: utf-8
import sys
input = sys.stdin.readline

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

t, d = [0] * Q, [0] * Q
for i in range(Q):
    td = input().split()
    t[i], d[i] = td[0], 2 * int(td[1] == 'R') - 1

l_min, r_min = 0, min(Q, N)
l_max, r_max = min(r_min, N - min(Q, N)), N

m_init = N // 2
tmp_init, s_tar = m_init, s[m_init]
for i in range(Q):
    if s_tar == t[i]:
        tmp_init += d[i]
        if tmp_init < 0 or N <= tmp_init: break
        s_tar = s[tmp_init]
#
if tmp_init < 0:
    l_min = l_max = m_init + 1
elif tmp_init >= N:
    r_max = r_min = m_init - 1
else: l_max = r_min = m_init

for _ in range(N):
    m_min = l_min + (r_min - l_min) // 2
    tmp_min, s_tar = m_min, s[m_min]
    for i in range(Q):
        if s_tar == t[i]:
            tmp_min += d[i]
            if tmp_min < 0 or N <= tmp_min: break
            s_tar = s[tmp_min] 
    #
    if tmp_min < 0: l_min = m_min + 1
    else: r_min = m_min
    if l_min >= r_min: break

for _ in range(N):
    if l_min == min(Q, N):
        l_max = r_max = 0
        break
    m_max = r_max - (r_max - l_max) // 2
    tmp_max, s_tar = m_max, s[m_max]
    for i in range(Q):
        if s_tar == t[i]:
            tmp_max += d[i]
            if tmp_max < 0 or N <= tmp_max: break
            s_tar = s[tmp_max]
    #
    if N <= tmp_max: r_max = m_max - 1
    else: l_max = m_max
    if l_max >= r_max: break

# print("#", (l_min, r_min), (l_max, r_max))
print(max(0, r_max - l_min + 1))