n, m = [int(i) for i in input().split()]
S = input()
Q = [[i for i in input().split()] for j in range(m)]

l = 0
r = n - 1
maxl = l
minr = r

for t, d in Q[::-1]:
    if t == S[l] and d == 'L':
        l += 1
        maxl = max(maxl, l)
    elif l > 0 and t == S[l - 1] and d == 'R':
        l -= 1
    if t == S[r] and d == 'R':
        r -= 1
        minr = min(minr, r)
    elif r + 1 < n and t == S[r + 1] and d == 'L':
        r += 1
    if l >= n or r < 0:
        break

print(max(0, minr - maxl + 1))