m, k = io.read("*n", "*n")
if m == 0 then
  print(k == 0 and "0 0" or -1)
elseif m == 1 then
  print(k == 0 and "0 1 1 0" or -1)
else
  local tot = (1 << m) - 1
  if tot < k then
    print(-1)
  else
    local ary = {}
    for i = 0, tot do
      if i ~= k then
        table.insert(ary, i)
      end
    end
    table.insert(ary, k)
    for i = tot, 0, -1 do
      if i ~= k then
        table.insert(ary, i)
      end
    end
    table.insert(ary, k)
    print(table.concat(ary, " "))
  end
end
