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

N = len(S)

l = 0
r = N-1

for i in range(Q-1, -1, -1):
    t,d = QUE[i]
    if N <= l: r = N-1; break
    if r <= -1: l = 0; break

    if d == "L" and t == S[l]:
        l += 1
    if d == "R" and t == S[r]:
        r -= 1

print(max(0, r-l+1))