import logging

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
h = logging.FileHandler("logtest.log")
logger.addHandler(h)

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

Query = []
for i in range(Q):
    Query.append(input().split())
logger.info("Query: {}".format(Query))

# left: 左に落ちるゴーレム
# right: 右に落ちるゴーレム
#  N-right-left: 生き残るゴーレム
left, right = 0, N - 1
logger.info("left: {}, right: {}".format(left, right))

# 二分探索
for ch, way in reversed(Query):
    if way == "L":
        if ch == s[left]:
            left += 1
        if right < N - 1 and ch == s[right + 1]:
            right = min(right + 1, N - 1)
    else:
        if left > 0 and ch == s[left - 1]:
            left = max(left - 1, 0)
        if ch == s[right]:
            right -= 1
print(max(0, right - left + 1))
