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)
for _ in range(N):
    if l_min >= r_min: break
    m_min = l_min + (r_min - l_min) // 2
    # print("# min", (l_min, r_min), m_min)
    tmp_min = m_min
    for i in range(Q):
        # print("##", tmp_min, ti)
        if s[tmp_min] == t[i]:
            tmp_min += d[i]
            if tmp_min < 0: break
            if N <= tmp_min: break
    #
    if tmp_min < 0:
        l_min = m_min + 1
    else:
        r_min = m_min

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

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