from collections import defaultdict, deque from sys import stdin readline = stdin.readline def li(): return list(map(int, readline().split())) N = int(input()) M1 = int(input()) A = li() M2 = int(input()) B = li() ans = [1] * (N + 1) ans[0] = 0 ans[N] = 0 # のぼり pos = 0 for a in A: pos += a ans[pos] = 0 # くだり for b in B: pos -= b ans[pos] = 0 print(sum(ans))