{$Q+,R+,S+}
program taskI;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  was:array[1..100000]of byte;
  prime:array[1..10000]of longint;
  kk,kprime:longint;
  nn,n,m,i,j:longint;
  tek:array[1..10000]of longint;
  ww:array[0..100000]of byte;
  rm,krm,kr,r:array[1..10000]of longint;
  lenrm,lenr:longint;
  f:boolean;
Procedure genprime;
begin
  nn:=100000;
  kprime:=0;
  for i:=2 to nn  do
    if was[i]=0 then
    begin
      j:=i;
      inc(kprime);
      prime[kprime]:=i;
      while j<=nn do
      begin
        was[j]:=1;
        inc(j,i);
      end;
      was[i]:=2;
    end;
end;
Procedure razl(ll,er:longint);
var
  i:longint;
begin
  lenr:=0;
  i:=1;
  while (ll<>1)and(i<=kprime) do
  begin
    if (ll mod prime[i]=0)and(ll>1) then
    begin
      inc(lenr);
      r[lenr]:=i;
      kr[lenr]:=0;
    end;
    while (ll mod prime[i]=0)and(ll>1) do
    begin
      inc(kr[lenr]);
      ll:=ll div prime[i];
    end;
    inc(i);
  end;
  if (ll>1)and(er=1) then lenr:=-1;
end;
Procedure proc(kk:longint);
var
  i:longint;
begin
  razl(n-kk+1,0);
  for i:=1 to lenr do inc(tek[r[i]],kr[i]);
  razl(kk,0);
  for i:=1 to lenr do dec(tek[r[i]],kr[i]);
end;

Procedure proces;
begin
  kprime:=0;
  for i:=1 to lenrm do
  begin
    prime[i]:=prime[rm[i]];
    rm[i]:=i;
  end;
  kprime:=lenrm;
  for i:=1 to n do
  begin
    proc(i);
    f:=true;
    for j:=1 to lenrm do
      if krm[j]>tek[rm[j]] then
      begin
        f:=false;
        break;
      end;
    if f then
    begin
      ww[i]:=1;
      inc(kk);
    end;
      

  end;

end;
begin
assign(input,'irrelevant.in');reset(input);
assign(output,'irrelevant.out');rewrite(output);
readln(n,m);
genprime;
razl(m,1);
krm:=kr;
rm:=r;
lenrm:=lenr;
dec(n);
if lenr<>-1 then proces;
if m=1 then
begin
  inc(kk);
  ww[0]:=1;
end;
writeln(kk);
for i:=0 to n do
  if ww[i]=1 then writeln(i+1);
close(input);
close(output);
end.
