{$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}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

var qc:array[1..1200000]of longint;
    res,i,j,n,m:longint;
begin
assign(input,'irrelevant.in');
assign(output,'irrelevant.out');
reset(input);
rewrite(output);
readln(n,m);
for i:=1 to n div 2 do
        qc[i]:=i;
for i:=n div 2 + 1 to n do
        qc[i]:=n-i+1;
res:=0;
for i:=1 to n do
        begin
        if qc[i] mod m = 0 then inc(res);
        end;
writeln(res);
for i:=1 to n do
        begin
        if qc[i] mod m = 0 then
        write(i,' ');
        end;
end.
