import string

alphabets = string.ascii_uppercase

N, Q = map(int, input().split())
S = input()
td = [list(input().split()) for _ in range(Q)]

pos = [0, len(S) + 1]
maxpos = [0, len(S) + 1]
ds = {"L": 1, "R": -1}
res = 0

for t, d in td[::-1]:
    left, right = pos
    mleft, mright = maxpos
    if left + ds[d] >= 1 and left + ds[d] <= N and t == S[left + ds[d] - 1]:
        if d == "L" and mleft == left:
            res += 1
        left += ds[d]
        mleft = max(mleft, left)
    if right + ds[d] >= 1 and right + ds[d] <= N and t == S[right + ds[d] - 1]:
        if d == "R" and mright == right:
            res += 1
        right += ds[d]
        mright = min(mright, right)
    if right <= left:
        res = N
        break
    pos = [left, right]
    maxpos = [mleft, mright]

print(N - res)
