N = int(input()) M = int(input()) A = list(map(int, input().split())) M = int(input()) B = list(map(int, input().split())) S = set() step = 0 for a in A: step+=a S.add(step) for b in B: step-=b S.add(step) print(N-len(S)+1)