program abc126f
  implicit none
  integer :: m, k, i
  integer,allocatable :: b(:), c(:)

  read *, m, k
  if (m == 0) then
     if (k == 0) then
        print *, '0 0'
     else
        print *, '-1'
     end if
  else if (m == 1) then
     if (k == 0) then
        print *, '0 0 1 1'
     else
        print *, '-1'
     end if
  else if (k >= 2**m) then
     print *, '-1'
  else
     b = [(i,i=0,2**m-1)]
     b = pack(b,b/=k)
     c = [(i,i=2**m-1,0,-1)]
     c = pack(c,c/=k)
     print *, [b,k,c,k]
  end if
end program abc126f
