type
        num=array[0..10000] of LongInt;
const   filein='irrelevant.in';
        outfile='irrelevant.out';
        maxn=100001;
var     i,j,k,l,m,n                     : LongInt;
        A                               : array[1..maxn] of byte;
        Cnk,temp                        : Num;
        f                               : Boolean;
        q                               : LongInt;

procedure mult(a: Num; c: LongInt; var b: Num);
var     i,l,p    : LongInt;
Begin
 fillchar(b,sizeof(b),0);
 L:=a[0]+10;
 for i:=1 to a[0] do
  b[i]:=a[i]*c;
 p:=0;
 for i:=1 to L+1 do
 begin
  b[i]:=b[i]+p;
  p:=b[i] div 10;
  b[i]:=b[i] mod 10;
 end;
 b[0]:=l+1;
 while (b[b[0]]=0)and(b[0]>0) do
  dec(b[0]);
End;

procedure divide(a: Num; b: longint; var c: num; var t: longint);
var     i,j,k,l,m,n     : LongInt;
begin
 fillchar(c,sizeof(c),0);
 l:=a[0]; m:=0;
 for i:=a[0] downto 1 do
 begin
  m:=m*10+(a[i]);
  if m=0 then
  begin
   inc(c[0]);
   c[c[0]]:=0;
  end;
  if m<b then continue;
  inc(c[0]);
  c[c[0]]:=M div b;
  m:=m mod b;
 end;
 for i:=1 to (c[0] div 2) do
 begin
  q:=c[i];
  c[i]:=c[c[0]-i+1];
  c[c[0]-i+1]:=q;
 end;
 t:=m;
end;

procedure inttonum(q: longint; var a: num);
var i   : LongInt;
        S       : String;
begin
 Str(q,S);
 fillchar(a,sizeof(a),0);
 a[0]:=Length(S);
 For i:=1 to a[0] do
  a[i]:=Ord(S[a[0]-i+1])-Ord('0');
end;

BEGIN
 fillchar(a,sizeof(a),0);
 Assign(Input,FileIn);
 Assign(Output,OutFile);
 Rewrite(Output);
 Reset(Input);
  Read(n,m);
  k:=0;
  fillchar(cnk,sizeof(cnk),0);
  cnk[0]:=1; cnk[1]:=1; q:=0;
  For i:=2 to ((N+1) div 2) do
  begin
{   if q>0 then
    IntToNum(q,Cnk);}
   l:=((((n-1)-(i-1)+1)));
   mult(Cnk,L,Cnk);
   divide(Cnk,i-1,Cnk,q);
   divide(Cnk,m,temp,q);
   if q=0 then
   begin
    inc(k);
    a[i]:=1;
    a[n-i+1]:=1;
    if i<>n-i+1 then inc(k);
   end;
  end;

  writeln(K); f:=false;
  for i:=1 to N do
   if a[i]=1 then
   begin
    if f then write(' ');
    f:=true;
    write(i);
   end;

 Close(input);
 Close(Output);
END.