import logging
import sys

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

# N, Q = map(int, input().split())
input = sys.stdin.readline

N, Q = tuple(map(int, input().split()))
logger.info("N: {}, Q: {}".format(N, Q))

s = input()
logger.info("s: {}".format(s))

Query = [input().split() for i in range(Q)]

left, right = 0, N - 1

# 二分探索: boundaryを求める
for t, d in reversed(Query):
    logger.info("t: {}, d: {}".format(t, d))
    logger.info("[before] left: {}, right: {}".format(left, right))
    if d == "L":
        if t == s[left]:
            left += 1
        if right < N - 1 and t == s[right + 1]:
            right = min(right + 1, N - 1)
    else:
        if left > 0 and t == s[left - 1]:
            left = max(left - 1, 0)
        if t == s[right]:
            right -= 1
    logger.info("[after] left: {}, right: {}\n".format(left, right))
print(right - left + 1)
