program non_triangular_triplets
  implicit none
  integer(8) :: n, k, i, m
  read(*,*) n, k
  if (2_8*k-1_8 > n) then
    write(*,'(i0)') -1
    stop
  end if
  m = n/2_8
  if (mod(n,2_8) == 1_8) then
    do i = 0_8, m-1_8
      write(*,'(i0,x,i0,x,i0)') k+2_8*i, k+3_8*m-i+1_8, k+4_8*m+i+2_8
      write(*,'(i0,x,i0,x,i0)') k+2_8*i+1_8, k+4_8*m-i+1_8, k+5_8*m+i+2_8
    end do
    write(*,'(i0,x,i0,x,i0)') k+2_8*m, k+2_8*m+1_8, k+6_8*m+2_8
  else
    do i = 0_8, m-1_8
      write(*,'(i0,x,i0,x,i0)') k+2_8*i, k+3_8*m-i-1_8, k+4_8*m+i
      write(*,'(i0,x,i0,x,i0)') k+2_8*i+1_8, k+4_8*m-i-1_8, k+5_8*m+i
    end do
  end if
end program non_triangular_triplets