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

N, Q = map(int, input().split())
s = list(input())
td = []
for _ in range(Q):
    ti, di = input().split()
    td.append((ti, 2 * int(di == 'R') - 1))


retire = [None] * Q
l_cnt = r_cnt = 0
for i, (ti, di) in enumerate(reversed(td)):
    if di > 0:
        r_cnt += 1
    else:
        l_cnt += 1
    retire[Q - 1 - i] = (l_cnt, N - r_cnt)


l_a, l_b = 0, min(Q, N)
r_a, r_b = min(l_b, N - min(Q, N)), N
 
m_init = N // 2
pos, s_tar = m_init, s[m_init]
for i, (ti, di) in enumerate(td):
    if retire[i][0] < pos < retire[i][1]:
        break
    elif s_tar == ti:
        pos += di
        if pos < 0 or N <= pos: break
        s_tar = s[pos] 
#
if pos < 0: l_a = m_init + 1
elif pos >= N: r_b = m_init - 1
else: r_a = l_b = m_init
 
for _ in range(N):
    m_min = l_a + (l_b - l_a) // 2
    pos, s_tar = m_min, s[m_min]
    for i, (ti, di) in enumerate(td):
        if retire[i][0] < pos < retire[i][1]:
            break
        elif s_tar == ti:
            pos += di
            if pos < 0 or N <= pos: break
            s_tar = s[pos] 
    #
    if pos < 0: l_a = m_min + 1
    else: l_b = m_min
    if l_a >= l_b: break

for _ in range(N):
    if r_b < l_a:
        break
    m_max = r_b - (r_b - r_a) // 2
    pos, s_tar = m_max, s[m_max]
    for i, (ti, di) in enumerate(td):
        if retire[i][0] < pos < retire[i][1]:
            break
        elif s_tar == ti:
            pos += di
            if pos < 0 or N <= pos: break
            s_tar = s[pos]
    #
    if N <= pos: r_b = m_max - 1
    else: r_a = m_max
    if r_a >= r_b: break
    
print(max(0, r_b - l_a + 1))