{DEFINE DMI}
{DEFINE DO0}
{DEFINE DEBUG}
{$IFDEF DEBUG}
{$B-,I+,N+,O-,Q+,R+,S+}
{$ELSE}
{$B-,I-,N+,O+,Q-,R-,S-}
{$ENDIF}
{$APPTYPE CONSOLE}
Program OlympSol;
uses SysUtils;
const TaskName = 'irrelevant';
 MaxN = 102; MaxK = 100006; MaxS = 100006; eps: Extended = 1E-11;
var i, j, k, l, m, n: Integer;
 p, q: array [1..MaxN] of Integer;
 ans: array [0..MaxS] of Boolean;
 ok: Boolean;
 r, s, sum: Integer;
 t: Int64;

BEGIN
 assign (input, TaskName + '.in'); reset (input);
 assign (output, TaskName + '.out'); rewrite (output);
{$IFDEF DMI} repeat {$ENDIF}
 read (n, m);
 dec (n);

 k := m;
 l := Trunc (sqrt (k) + eps);
 s := 0;
 j := 2;
 while j <= l do begin
  if k mod j = 0 then begin
   inc (s); p[s] := j;
   while k mod j = 0 do begin
    inc (q[s]);
    k := k div j;
   end;
   l := Trunc (sqrt (k) + eps);
  end;
  inc (j);
 end;
 if (k > 1) AND (k <= MaxK) then begin
  inc (s); p[s] := k; q[s] := 1;
 end;
 if k > MaxK then begin writeln (0); writeln; end else begin
{$IFDEF DO0} for i := 1 to s do writeln (p[i], ' ', q[i]); {$ENDIF}
  r := 0;
  for i := 0 to n do begin
   ans[i] := True;
   for j := 1 to s do begin
    sum := 0;
{$IFDEF DO0} write (i, ' ', p[j], ' '); {$ENDIF}
    k := n;
    t := p[j]; while t <= k do begin inc (sum, k div t); t := t * p[j]; end;
{$IFDEF DO0} write (sum, ' '); {$ENDIF}
    k := i;
    t := p[j]; while t <= k do begin dec (sum, k div t); t := t * p[j]; end;
{$IFDEF DO0} write (sum, ' '); {$ENDIF}
    k := n - i;
    t := p[j]; while t <= k do begin dec (sum, k div t); t := t * p[j]; end;
{$IFDEF DO0} write (sum, ' '); {$ENDIF}
{$IFDEF DO0} writeln (q[j]); {$ENDIF}
    if sum < q[j] then begin ans[i] := False; break; end;
   end;
   inc (r, ord (ans[i]));
  end;
  ok := False;
  writeln (r);
  for i := 0 to n do if ans[i] then begin
   if NOT ok then ok := True else write (' ');
   write (i + 1);
  end;
 end;
 writeln;
{$IFDEF DMI} until seekeof; {$ENDIF}
END.
