N, Q = map(int,input().split())
s = [_ for _ in input()]
td = [[_ for _ in input().split()] for _ in range(Q)]
GLM = [1 for _ in range(N)]

left = 0
right = N - 1

# 命令を逆から見ていき、場外に行かないゴーレムの範囲を求める。
# 場外命令が出た場合、その内側までが安置
for t, d in reversed(td):
    if t == s[left] and d == "L":
        left += 1

    elif t == s[right] and d == "R":
        right -= 1

print(sum(GLM[left:right + 1]))