{$O+,R-,Q-}
var
 res, curn, m, cur, i,n:longint;
 a, r:array[1..100011] of longint;
 
 mnump, nump: integer;
 mpr, mpw, pr, pw: array[1..100] of integer;

 

procedure razl( x: integer );
  var
    sqrtx: integer;
    i: integer;
  begin
    nump := 0;
    sqrtx := trunc( sqrt(x ) ) + 1;
    i := 2;
    while i <= sqrtx do begin
      if x mod i = 0 then begin
        inc( nump );
        pr[nump] := i;
        pw[nump] := 0;
        while x mod i = 0 do begin
          inc ( pw[nump] );
          x := x div i;
        end;
        sqrtx := trunc( sqrt(x ) ) + 1;
      end;
      inc( i );
    end;
    if x <> 1 then begin
      inc( nump );
      pr[ nump ] := x;
      pw[ nump ] := 1;
    end;
  end;


procedure plus;
  var
    i: integer;
  begin
    for i := 1 to nump do
      r[ pr[i] ] := r[ pr[i] ] + pw[i];
  end;

procedure minus;
  var
    i: integer;
  begin
    for i := 1 to nump do
      r[ pr[i] ] := r[ pr[i] ] - pw[i];
  end;


function test: boolean;
  var
    i: integer;
  begin
    for i := 1 to mnump do begin
      if mpr[i] > 1000000 then begin result := false; exit; end;
      if r[ mpr[i] ] < mpw[i] then begin
        test := false;
        exit;
      end;
    end;
    test := true;
  end;

begin
 assign(input,'irrelevant.in'); reset(input);
 assign(output,'irrelevant.out'); rewrite(output);
 read(n, m);
 n := n - 1;
 razl( m );
 mnump := nump;
 mpw := pw;
 mpr := pr;
 res := 0;
 for i := 0 to n do begin
   if test then begin
     inc( res );
     a[ res ] := i;
   end;
   if i <> n then begin
     razl( n - i );
     plus;
     razl( i + 1);
     minus;
   end;
 end;
 
 writeln( res );
 for i := 1 to res do write( a[i] + 1, ' ' );
 writeln;
end.