program non_triangular_triplets
  implicit none
  integer :: n, k, i
  integer(8) :: a, b, c
  read(*,*) n, k
  if (2*k-1 > n) then
    write(*,'(i0)') -1
    stop
  end if
  a = k
  b = k+n+(n-1)/2
  c = k+2*n
  do i = 0, n-1, 2
    write(*,'(i0,x,i0,x,i0)') a, b, c
    a = a+2
    b = b-1
    c = c+1
  end do
  a = k+1
  b = k+2*n-1
  do i = 1, n-1, 2
    write(*,'(i0,x,i0,x,i0)') a, b, c
    a = a+2
    b = b-1
    c = c+1
  end do
end program non_triangular_triplets