n, q = map(int, raw_input().split())
s = raw_input()
td = [raw_input().split() for _ in range(q)];
left, right = 0, n
for t, d in reversed(td):
    if d == 'L' and left < n and s[left] == t:
        left += 1
    if d == 'R' and right > 0 and s[right - 1] == t:
        right -= 1
print max(0, right - left)
