program rotation_matching
  implicit none
  integer :: n, m, i = 0, j, cnt = 0, maxm
  read(*,*) n, m
  maxm = (n-1)/2
  do
    write(*,'(i0,x,i0)') i+1, maxm+1-i
    cnt = cnt+1
    if (cnt == m) stop
    write(*,'(i0,x,i0)') maxm+2+i, n-i
    cnt = cnt+1
    if (cnt == m) stop
    i = i+1
  end do
end program rotation_matching