program main implicit none integer::n,k,i,j integer::num(20171) data num/20171*0/ read *,n,k num(1) = 0 num(2) = 2 do i=4, n-k, 2 num(i) = i/2+1 end do do i=3, n-k, 2 num(i) = i/2 end do j = i/2 + 1 - MOD(n-k,2) do i=n-k+1,n num(i) = j end do write (*,'(i0)',advance='no') num(1) write (*,'(20170(1x,i0))') num(2:n) end program main