n=int(input)
t=int(input()
p=[]
for m in range(t):
p.append(int(input())
s=[]
while true:
s.append(p[random.randint(1,len(p))]) if sum(s)==n: break