{$A+,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q+,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE GUI}
program I;

{$APPTYPE CONSOLE}

const fname = 'irrelevant';
      ifile = fname + '.in';
      ofile = fname + '.out';
      MAXN  = 101000;
      MAXNUM = 101000;

var n,m,nn,num,nums,numo: longint;
    pr: array[1..MAXN+100]of byte;
    o: array[1..MAXN]of longint;
    raz: array[1..MAXN+100,1..2]of longint;
    p: array[1..MAXNUM]of longint;
    mas: array[1..MAXNUM]of longint;
    mm: array[1..MAXNUM,1..2]of longint;

procedure load();
begin
  read(n,m);
end;

procedure rec(x: longint; y: int64);
var k: longint;
    yy: int64;
begin
  for k:=x to num do begin
    yy:=y*p[k];
    if (yy<=nn) then begin
      if raz[yy,1]=0 then begin
        raz[yy,1]:=k;
        raz[yy,2]:=y;
        rec(k,yy);
      end;
    end
    else
      break;
  end;
end;           

procedure umn(x: longint);
begin
  if x>1 then begin
    while raz[x,1]>0 do begin
      inc(mas[raz[x,1]]);
      x:=raz[x,2];
    end;
  end;
end;

procedure del(x: longint);
begin
  if x>1 then begin
    while raz[x,1]>0 do begin
      dec(mas[raz[x,1]]);
      x:=raz[x,2];
    end;
  end;
end;

procedure solve();
var k,l: longint;
    kk: int64;
    ok: boolean;
begin
  nn:=n+100;
  for k:=2 to nn do
    if pr[k]=0 then begin
      inc(num);
      p[num]:=k;
      kk:=int64(k)*k;
      while kk<=nn do begin
        pr[kk]:=1;
        inc(kk,k);
      end;
    end;
  rec(1,1);
  for k:=1 to num do 
    if m mod p[k]=0 then begin
      inc(nums);
      mm[nums,1]:=k;
      mm[nums,2]:=1;
      m:=m div p[k];
      while m mod p[k]=0 do begin
        inc(mm[nums,2]);
        m:=m div p[k];
      end;
      if m=1 then break;
    end;
  if m>1 then begin
    writeln('0');
    exit;
  end;
  dec(n);
  for k:=1 to n do begin
    umn(n-k+1);
    del(k);
    ok:=true;
    for l:=1 to nums do
      if mas[mm[l,1]]<mm[l,2] then begin
        ok:=false;
        break;
      end;
    if ok then begin
      inc(numo);
      o[numo]:=k+1;
    end;
  end;
  writeln(numo);
  if numo>0 then begin
    for k:=1 to numo-1 do
      write(o[k],' ');
    writeln(o[numo]);
  end;
end;

procedure save();
begin

end;

begin
  assign(input,ifile);
  reset(input);
  assign(output,ofile);
  rewrite(output);
  load;
  solve;
  save;
end.
 