program probI;
{$APPTYPE CONSOLE}
const
     maxn = 100000;
     maxp = 10000;
var
  tup, tpm, alpm,  alpn, alpk : array[1..maxp] of longint;
  rezs :array[1..maxn]of longint;
  n, m, nz, i,j,k,l,p, dm : longint;
  f:boolean;
begin
  assign(input,'irrelevant.in');
  reset(input);
  assign(output, 'irrelevant.out');
  rewrite(output);
  read(n);
  read(m);
  p := 1;
  tup[1] := 2;
  for i := 3 to n - 1 do begin
      j := 1;
      while tup[j]*tup[j]<=i do begin
        if i mod tup[j] = 0 then begin
            j:=-1;break;
        end;
        inc(j);
      end;
     if j > 0 then begin
       inc(p);
       tup[p]:=i;
     end;
  end;
  {tugri}
  l := m;
  dm := 0;
  for i := 1 to p do if l mod tup[i] = 0  then begin
     inc(dm);
     tpm[dm] := tup[i];
     alpm[dm] := 0;
     repeat
       inc(alpm[dm]);
       l := l div tpm[dm];
     until l mod tpm[dm] > 0;
  end;

  if l > 1 then begin
     writeln(0);
     exit;
  end;

  for i := 1 to dm do begin
     alpn[i] := 0;
     k := tpm[i];
     l := n - 1;
     while  k<=l do begin
         inc(alpn[i], l div k);
         k := k*tpm[i];
     end;
  end;
  nz := 0;

  for  i := 0 to n - 1 do begin
    alpk := alpn;

    for j := 1 to dm do begin
     k := tpm[j];
     l := i;
     while  k <= l do begin
         dec(alpk[j], l div k);
         k := k*tpm[j];
     end;
  end;

  for j := 1 to dm do begin
     k := tpm[j];
     l := n - i - 1;
     while  k <= l do begin
         dec(alpk[j], l div k);
         k := k*tpm[j];
     end;
  end;
  f := true;
  for j:=1 to dm do
  if alpk[j] < alpm[j] then begin
      f := false;
      break;
  end;
  if f then begin
    inc(nz);
    rezs[nz] := i + 1;
  end;
  end;
  writeln(nz);
  for i:=1 to nz do write(rezs[i],' ');

  if nz > 0 then writeln;

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