n=list(map(int, input().split())) b=[] for i in range(int(n[0])+1): for j in n[1:]: if j==i: b.append(i) for i in range(n[0]+1): if i !=b[i]: print(i) break
n=list(map(int, input().split())) b=[] for i in range(int(n[0])+1): for j in n[1:]: if j==i: b.append(i) for i in range(n[0]+1): if i !=b[i]: print(i) break