const
 maxm=32;
 maxk=100000+10;

var
 m,n:integer;
 mn:integer;
 ms,md:array[0..maxm-1]of integer;

procedure fact(m:integer);
 var
  p,j:integer;
 begin
  p:=2; mn:=0;
  while(p*p<=m)do begin
   if(m mod p=0)then begin
    j:=0;
    while(m mod p=0)do begin
     inc(j);
     m:=m div p;
    end;
    ms[mn]:=p; md[mn]:=j;
    inc(mn);
   end;
   inc(p,1+p and 1);
  end;
  if(m>1)then begin
   ms[mn]:=m; md[mn]:=1;
   inc(mn);
  end;
 end;

var
 fs,cs:array[0..maxm-1]of integer;

procedure facti(x:integer);
 var
  i,j,p:integer;
 begin
  for i:=0 to mn-1 do begin
   p:=ms[i]; j:=0;
   while(x mod p=0)do begin
    x:=x div p;
    inc(j);
   end;
   fs[i]:=j;
  end;
 end;

{procedure getmns;
 var
  i,j,cn,p:integer;
 begin
  for i:=0 to mn-1 do begin
   j:=0; cn:=n; p:=ms[i];
   while(cn>0)do begin
    cn:=cn div p;
    j:=j+cn;
   end;
   mns[i]:=j+md[i];
  end;
 end;}

function good(k:integer):boolean;
 var
  i:integer;
 begin
  facti(k); for i:=0 to mn-1 do dec(cs[i],fs[i]);
  facti(n-k+1); for i:=0 to mn-1 do inc(cs[i],fs[i]);
  good:=true;
  for i:=0 to mn-1 do
   if(cs[i]<md[i])then begin
    good:=false;
    exit;
   end;
 end;

var
 resn:integer;
 res:array[0..maxk]of integer;

procedure solvewriteout;
 var
  k:integer;
 begin
  resn:=0;
  fillchar(cs,sizeof(cs),0);
  for k:=1 to n-1 do if(good(k))then begin
   res[resn]:=k;
   inc(resn);
  end;
  writeln(resn);
  for k:=0 to resn-1 do begin
   write(res[k]+1);
   if(k<resn-1)then write(' ');
  end;
 end;

begin
 assign(input,'irrelevant.in'); reset(input);
 assign(output,'irrelevant.out'); rewrite(output);
 readln(n,m); dec(n);
 if(n>0)then begin
  fact(m);
  solvewriteout;
 end else writeln('0');
 close(output);
 close(input);
end.