$|=1; ($n,$k)=<>=~/\d+/g; $v=0; while(1){ while(($n-$v)%($k+1)!=1){ ++$v; } print"$v\n"; $v=<>; last if $v>$n; }