var n,totalw,i,t,s:longint;
w,q,ans:array[0..1000]of longint;
procedure find(x:longint);
var i,j,b:longint;
begin
if x=0 then
begin
inc(s);
ans:=q;
for i:=1 to q[0]-1 do
if (w[q[i]]=w[q[i]+1]) and (q[i+1]<>q[i]+1) then inc(s);
if (q[q[0]]+1<=n) and (w[q[q[0]]]=w[q[q[0]]+1]) then inc(s);
if s>1 then begin write(-1);halt;end;
end
else begin
b:=q[q[0]]+1;
for i:=b to n do
if ((q[q[0]+1]=-1) or (w[i]<>w[q[q[0]+1]])) and (x-w[i]>=0) then
begin
inc(q[0]);q[q[0]]:=i;
find(x-w[i]);;
dec(q[0]);
end;
end;
end;
begin
assign(input,'bagb.in');
assign(output,'bagb.out');
reset(input);
rewrite(output);
read(totalw,n);
s:=0;
w[0]:=-1;q[0]:=0;
for i:=1 to n do begin read(w[i]);s:=s+w[i];q[i]:=-1;end;
if totalw>=s then begin write(0);halt;end;
totalw:=s-totalw;
s:=0;
find(totalw);
if s=0 then write(s)
else begin
write(ans[1]);
for i:=2 to ans[0] do write(' ',ans[i]);
end;
end.