n = int(input()) N = n m = int(input()) A = list(map(int,input().split())) ans = [0] * (N + 1) now = 0 ans[0] = 1 for a in A: now += a ans[now] = 1 m = int(input()) B = list(map(int,input().split())) for b in B: now -= b ans[now] = 1 print(N + 1 - sum(ans))