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':
        if left < n and s[left] == t:
            left += 1
        if right < n and s[right] == t:
            right += 1
    elif d == 'R':
        if left > 0 and s[left - 1] == t:
            left -= 1
        if right > 0 and s[right - 1] == t:
            right -= 1
print max(0, right - left)