N=int(input()) D=[1]*(N+1) M=int(input()) A=list(map(int, input().split())) now=0 for a in A: now+=a D[now]=0 M=int(input()) A=list(map(int, input().split())) now=-1 for a in A: now-=a D[now]=0 print(sum(D))