n = int(input()) _ = int(input()) a = list(map(int, input().split())) _ = int(input()) b = list(map(int, input().split())) d = [True for _ in range(n+1)] now = 0 for x in a: now += x d[now] = False for x in b: now -= x d[now] = False print(d.count(True))