{$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}
program pr_i;

{$APPTYPE CONSOLE}


var
  c,d:array[-1..100001,0..40]of longint;
  mp,md:array[0..40]of longint;
  x,y,n,m,mm,ans,i,j,k:longint;
  pr:boolean;
  anss:array[0..100001]of longint;
begin
  assign(input,'irrelevant.in');reset(input);
  assign(output,'irrelevant.out');rewrite(output);

  read(n,m);

  fillchar(c,sizeof(c),0);
  fillchar(d,sizeof(d),0);
  ans:=0;
  i:=0;
  j:=2;
  mm:=1+round(sqrt(m));
  while (m>1) and (j<mm) do begin
    while (j<mm)and(m mod j <>0)do j:=j+1;
    if m mod j = 0 then begin
      inc(i);
      mp[i]:=j;
      md[i]:=0;
      while m mod j=0 do begin
        m:=m div j;
        inc(md[i]);
      end;
      mm:=1+round(sqrt(m));
    end;
  end;
  if m>1 then begin
    j:=m;
    if m mod j = 0 then begin
      inc(i);
      mp[i]:=j;
      md[i]:=0;
      while m mod j=0 do begin
        m:=m div j;
        inc(md[i]);
      end;
      mm:=1+round(sqrt(m));
    end;
  end;
  k:=i;
  n:=n-1;
  for j:=1 to k do c[0,j]:=md[j];
  for i:=1 to n do begin
    x:=n-i+1;
    y:=i;
    pr:=true;
    for j:=1 to k do begin
      d[i,j]:=d[i-1,j];
      c[i,j]:=c[i-1,j];
      while (x mod mp[j]=0) do begin
        x:=x div mp[j];
        inc(d[i,j]);
      end;
      while (y mod mp[j]=0) do begin
        y:=y div mp[j];
        inc(c[i,j]);
      end;
      if (c[i,j]>d[i,j]) then pr:=false;
    end;
    if pr then begin
      ans:=ans+1;
      anss[ans]:=i+1;
    end;
  end;
  writeln(ans);
  for i:=1 to ans do write(anss[i],' ');
  writeln;

  close(input);
  close(output);
end.
