{$APPTYPE CONSOLE}
const maxn=100002;
var nans,np,md,n:longint;
    p,am,qam:array[1..100] of longint;
    ans:array[1..maxn] of longint;

procedure readdata;
begin
 read(n,md);
 n:=n-1;
end;

procedure solve;
var i:longint;
begin
 np:=0;
 for i:=2 to trunc(sqrt(md)) do
 if md mod i=0 then
  begin
   np:=np+1;
   p[np]:=i;
   am[np]:=0;
   while md mod i=0 do
   begin
    md:=md div i;
    am[np]:=am[np]+1;
   end;
  end;
 if md>1 then
  begin
   np:=np+1;
   p[np]:=md;
   am[np]:=1;
  end;
end;

procedure calc(a:longint;d:longint);
var i:longint;
begin
 for i:=1 to np do
 while a mod p[i]=0 do
 begin
  a:=a div p[i];
  qam[i]:=qam[i]+d;
 end;
end;

procedure outdata;
var ok,i,k:longint;
begin
 fillchar(qam,sizeof(qam),0);
 nans:=0;
 for k:=0 to n-1 do
 begin
  calc(k+1,-1);
  calc(n-k,1);
  ok:=1;
  for i:=1 to np do
  if qam[i]<am[i] then
   begin
    ok:=0;
    break;
   end;
  if ok=1 then
   begin
    nans:=nans+1;
    ans[nans]:=k+2;
   end;
 end;
 writeln(nans);
 for i:=1 to nans do
 write(ans[i],' ');
 writeln;
end;

begin
 assign(input,'irrelevant.in');
 reset(input);
 assign(output,'irrelevant.out');
 rewrite(output);
 readdata;
 solve;
 outdata;
 close(output);
end.
