program IIII;
{$APPTYPE CONSOLE}
uses SysUtils;
const _NAME='irrelevant';
var n, m: Integer;
    i: Integer;
    fout: Text;

procedure Input;
var F: Text;
begin
  Assign(F, _NAME+'.in');
  Reset(F);
  ReadLn(F, n, m);
  Close(F);
end; // Input


begin
  Input;
  if n<=2 then Exit;

  Assign(Fout, _NAME+'.out');
  ReWrite(Fout);
  if (n-1) mod m=0 then begin
    WriteLn(fout, n-2);
    for i:=2 to n-1 do Write(fout, i, ' ');
  end;

  Close(Fout);

end.
