var x,i,j,n,m,maxs,k,s,c,l:integer;t,t1:text;a,b:array[1..1000] of integer;
begin
readln(n,m);
for i:=1 to m do
   begin
        read(a[i]);s:=a[i]+s;
   end;b:=a;
   for i:=1 to m do
   begin
   if a[i]<a[i+1] then begin j:=i;
   repeat if a[j]<a[j+1] then x:=a[j];a[j]:=a[j+1];a[j+1]:=x;
   j:=j-1;
   until (j<1)or(a[j]>a[j+1]);end; end;

i:=1;
repeat
c:=a[i]+c;
if c>=n then           begin  writeln(i);
for j:=1 to i do
begin
for l:=1 to m do
if a[j]=b[l] then begin writeln(l,' ');b[l]:=0; break;end;
end;
k:=1      end;
i:=i+1;c:=c-2;
if c<0 then c:=n+10;
until c+2>=n;
if k<>1 then writeln('Epic fail');
end.





