{$o-,r+,q+}
const
 maxp = 100005;

var


 flag: boolean;
 pr: array [1..maxp] of boolean;
 cnt, ci, cp, j, msn, mm, m, k, n, i: integer;
 mp, ms: array [0..100] of integer;
 fact: array [0..100, -1..maxp] of integer;
 ans: array [0..maxp] of integer;


begin
 assign (input, 'irrelevant.in'); reset(input);
 assign (output, 'irrelevant.out'); rewrite(output);

 read(n, m);

 fillchar(pr, sizeof(pr), true);


 for i:=2 to n do begin
  if pr[i] then begin
   k:= 2*i;
   while k<=maxp do begin
    pr[k]:= false;
    k:= k + i;
   end;
  end;
 end;


 fillchar(ms, sizeof(ms), 0);
 mm:=m;
 msn:=0;
 for i:=2 to maxp do begin
  if mm = 1 then break;
  if pr[i] then begin
   if mm mod i = 0 then begin
    inc(msn);
    mp[msn]:= i;
   end;
   while mm mod i = 0 do begin
    inc(ms[msn]);
    mm:= mm div i;
   end;
  end;
 end;

 if mm > 1 then begin
  inc(msn);
  mp[msn]:= mm;
  ms[msn]:= 1;
 end;

 fillchar(fact, sizeof(fact), 0);


 for j:=1 to msn do begin
  for i:=1 to n do begin
   cp:= 0;
   ci:= i;
   while ci mod mp[j] = 0 do begin
    inc(cp);
    ci:= ci div mp[j];
   end;
    fact[j, i]:= fact[j, i-1] + cp; 
  end;
 end;

 cnt:= 0;
 dec(n);
 for i:=0 to n do begin
  flag:= true;
  for j:=1 to msn do begin
   if fact[j, n] - fact[j, i] - fact[j, n -i] < ms[j] then
    flag:= false;
  end;

  if flag then begin
   inc(cnt);
   ans[cnt]:= i + 1;
  end; 


 end;  


 writeln(cnt);
 for i:=1 to cnt do begin
  write(ans[i], ' ');
 end;



end.