Merge sort is a well-known sorting algorithm. The main function that sorts the elements of array a with indices from [l, r) can be implemented as follows:  If the segment [l, r) is already sorted in non-descending order (that is, for any i such that l ≤ i < r - 1 a[i] ≤ a[i + 1]), then end the function call;  Let $\operatorname{mid} = \lfloor \frac{l + r}{2} \rfloor$;  Call mergesort(a, l, mid);  Call mergesort(a, mid, r);  Merge segments [l, mid) and [mid, r), making the segment [l, r) sorted in non-descending order. The merge algorithm doesn't call any other functions. 

The array in this problem is 0-indexed, so to sort the whole array, you need to call mergesort(a, 0, n).

The number of calls of function mergesort is very important, so Ivan has decided to calculate it while sorting the array. For example, if a = {1, 2, 3, 4}, then there will be 1 call of mergesort — mergesort(0, 4), which will check that the array is sorted and then end. If a = {2, 1, 3}, then the number of calls is 3: first of all, you call mergesort(0, 3), which then sets mid = 1 and calls mergesort(0, 1) and mergesort(1, 3), which do not perform any recursive calls because segments (0, 1) and (1, 3) are sorted.

Ivan has implemented the program that counts the number of mergesort calls, but now he needs to test it. To do this, he needs to find an array a such that a is a permutation of size n (that is, the number of elements in a is n, and every integer number from [1, n] can be found in this array), and the number of mergesort calls when sorting the array is exactly k.

Help Ivan to find an array he wants!


-----Input-----

The first line contains two numbers n and k (1 ≤ n ≤ 100000, 1 ≤ k ≤ 200000) — the size of a desired permutation and the number of mergesort calls required to sort it.


-----Output-----

If a permutation of size n such that there will be exactly k calls of mergesort while sorting it doesn't exist, output  - 1. Otherwise output n integer numbers a[0], a[1], ..., a[n - 1] — the elements of a permutation that would meet the required conditions. If there are multiple answers, print any of them.


-----Examples-----
Input
3 3

Output
2 1 3 
Input
4 1

Output
1 2 3 4 
Input
5 6

Output
-1

Difficulty: interview

Starter code:

Solutions:
def create_list(n, num_of_calls):
    if n == 1:
        return [1], 0
    if n == 2:
        return [2, 1], 2
    if num_of_calls == 2:
        return list(range(2, n // 2 + 2)) + [1] +\
               list(range(n // 2 + 2, n + 1)), 2

    list1, num_of_calls1 = create_list(n // 2, num_of_calls - 2)
    if num_of_calls1 == num_of_calls - 2:
        return list1 + list(range(n // 2 + 1, n + 1)), num_of_calls

    list2, num_of_calls2 = create_list((n + 1) // 2,
                                       num_of_calls - num_of_calls1 - 2)
    return list1 + [x + n // 2 for x in list2], \
        num_of_calls1 + num_of_calls2 + 2


def main():
    n, k = [int(x) for x in input().split()]
    if k % 2 != 1:
        print(-1)
        return

    if k == 1:
        print(' '.join([str(x) for x in range(1, n + 1)]))
        return

    num_list, num_of_calls = create_list(n, k - 1)
    if num_of_calls != k - 1:
        print(-1)
        return
    print(' '.join([str(x) for x in num_list]))


def __starting_point():
    main()

__starting_point()

# -*- coding: utf-8 -*-

import math
import collections
import bisect
import heapq
import time
import random

"""
created by shhuan at 2017/10/14 15:30

"""

n, k = map(int, input().split())

if k & 1 == 0 or k > 2*n-1:
    print(-1)
else:
    a = [0] * n
    gs = (k-1)//2

    def unsort(l, r, v):
        if l == r-1:
            a[l] = v
        else:
            nonlocal gs
            if gs > 0:
                gs -= 1
                mid = (l+r)//2
                unsort(l, mid, v+r-mid)
                unsort(mid, r, v)
            else:
                for i in range(r-l):
                    a[l+i] = v+i

    unsort(0, n, 1)

    print(' '.join([str(x) for x in a]))

'''
Based on solution from Firepaw which is awesome
'''

k1 = 0


def main():
    n, k = [int(x) for x in input().split()]
    if k & 1 == 0 or k > 2*n-1:
        print("-1")
    else:
        lst = [0]*n

        # k1 count how many recursions left, drain one for the initial  call
        nonlocal k1
        k1 = k - 1

        # solve the task for [l, r)
        # Filling array with values val, val+1, ...
        def fill_arr(l, r, val):
            nonlocal k1
            # list size 1, nothing to do just set the value
            if r <= l+1:
                lst[l] = val
            elif k1 == 0:
                # just fill in a sorted array - no more calls here
                for i in range(l, r):
                    lst[i] = val + i - l
            else:
                # drain 2 recursion calls (for left and right path)
                k1 -= 2
                # call subproblems
                m = (l+r) // 2
                # set initial vals for left path as [val + r-m, ... , val + r)
                fill_arr(l, m, val+r-m)

                # set initial vals for right path as [val, val+1, ... , val + r-m)
                fill_arr(m, r, val)

                # after filling subproblems we are sure list is not sorted
                # this justifies the draining k1

        fill_arr(0, n, 1)
        #assert(k1 == 0)
        print(" ".join(map(str, lst)))


def __starting_point():
    main()

__starting_point()

'''
Based on solution from Firepaw which is awesome
'''

k1 = 0


def main():
    n, k = [int(x) for x in input().split()]
    if k & 1 == 0 or k > 2*n-1:
        print("-1")
    else:
        lst = [0]*n

        # k1 count how many recursions left, drain one for the initial  call
        nonlocal k1
        k1 = k - 1

        # solve the task for [l, r)
        # Filling array with values val, val+1, ...
        def fill_arr(l, r, val):
            nonlocal k1
            # list size 1, nothing to do just set the value
            if r <= l+1:
                lst[l] = val
            elif k1 == 0:
                # just fill in a sorted array - no more calls here
                for i in range(l, r):
                    lst[i] = val + i - l
            else:
                # drain 2 recursion calls (for left and right path)
                k1 -= 2
                # call subproblems
                m = (l+r) // 2
                # set initial vals for left path as [val + r-m, ... , val + r)
                fill_arr(l, m, val+r-m)

                # set initial vals for right path as [val, val+1, ... , val + r-m)
                fill_arr(m, r, val)

                # after filling subproblems we are sure list is not sorted
                # this justifies the draining k1

        fill_arr(0, n, 1)
        print(' '.join([str(x) for x in lst]))


def __starting_point():
    main()

__starting_point()

n, k = [int(i) for i in input().split()]
if k % 2 == 0 or k >= 2 * n:
    print(-1)
    return
last = n
a = [0] * n
def ans(c, l, r):
    nonlocal last
    if c == 1:
        i = r - 1
        while i >= l:
            a[i] = last
            last -= 1
            i -= 1
        return
    m = (l + r) // 2
    ans(c // 2 - int((c // 2) % 2 == 0), l, m)
    ans(c // 2 + int((c // 2) % 2 == 0), m, r)
ans(k, 0, n)
print(*a)


n, k = [int(i) for i in input().split()]
if k % 2 == 0 or k >= 2 * n:
    print(-1)
    return
last = n
a = [0] * n
def ans(c, l, r):
    nonlocal last
    if c == 1:
        i = r - 1
        while i >= l:
            a[i] = last
            last -= 1
            i -= 1
        return
    m = (l + r) // 2
    ans(c // 2 - int((c // 2) % 2 == 0), l, m)
    ans(c // 2 + int((c // 2) % 2 == 0), m, r)
ans(k, 0, n)
print(*a)


n,m = list(map(int, input().split()))

res = []

def solve(begin, end, rem):
	#print('Solve:', begin, end, rem)
	if rem<2:
		res.extend(list(range(begin,end)))
		return rem
	if end-begin==1:
		res.append(begin)
		return rem
	rem -= 2
	mid = (begin+end+1)//2
	rem = solve(mid, end, rem)
	rem = solve(begin, mid, rem)
	return rem

rem = solve(1, n+1, m-1)
if rem == 0:
	print(' '.join(map(str, res)))
else:
	print(-1)
	#print(rem)
	#print(res)


n,k=map(int,input().split())
if not k&1:print(-1);return()
k-=1
a=[int(i+1) for i in range(n)]
def f(l,r):
    nonlocal k
    if k<2or r-l<2:return
    k-=2
    m=(l+r)//2
    a[m],a[m-1]=a[m-1],a[m]
    f(l,m)
    f(m,r)
f(0,n)
if k:print(-1);return()
for i in a:
    print(int(i),end=' ')



n,k=map(int,input().split())
a=[i+1 for i in range(n)]
if not k&1:print(-1);return()
k-=1
def f(l,r):
    nonlocal k
    if(k<2 or r-l<2): return
    k-=2
    m=(l+r)//2
    a[m-1],a[m]=a[m],a[m-1]
    f(l,m)
    f(m,r)
f(0,n)
if not k==0:print(-1);return()
for i in a:
    print(int(i),end=" ")




def arr(n,k,l):
    nonlocal flag
    #print(n,k,l)    

    if k == 0:
        return(list(range(l,l+n)))

    if n == 1:
        flag = True
        return([0])
    

    if (k%4 == 2): k1 = k2 = k//2 - 1 
    else:
        k1 = (k-4)//2
        k2 = k1+2

    n1 = n//2
    n2 = n-n1
     
    a1 = arr(n1,k1,l+n2)
    a2 = arr(n2,k2,l)

    a1.extend(a2)
    return( a1 )

n,k = [int(i) for i in input().split()]
        
flag = False

ans = arr(n,k-1,1)

if (k%2 == 0): flag = True

if flag: print(-1)
else:
    for i in ans: print(i,end = " ")


import os
import sys
import copy
num = 0
a = None
# sys.stdin = open(os.path.join(os.path.dirname(__file__),'35.in'))
k = None
def solve():
    nonlocal k,a
    n, k = map(lambda x:int(x), input().split())
    savek = copy.deepcopy(k)
    # print(a)
    a = [_+1 for _ in range(n)]

    def mgsort(l, r):
        nonlocal num,a,k
        mid = (l+r) >> 1
        if r - l == 1 or k == 1:
            return
        k -= 2
        a[l:mid] , a[mid:r] = a[mid:r] , a[l:mid]
        mgsort(l, mid)
        mgsort(mid, r)
    if k % 2 != 0:  
        mgsort(0, n)
        
    if k == 1:
        for i in a:
            print(i,sep=' ',end=' ')
    else:
        print(-1)
solve()

n, k = map(int,input().split())
if k % 2 == 0:
    print(-1);return()
k -= 1
a = [int(i+1) for i in range(n)] 
def f(l,r):
    nonlocal k
    if k < 2 or r-l < 2:
        return
    k-=2
    m=(l+r)//2
    a[m], a[m-1] = a[m-1], a[m]
    f(l,m)
    f(m,r)
f(0,n)
if k:print(-1);return()
for i in a:
    print(int(i),end=' ')

n, k = map(int,input().split())
if k % 2 == 0:
    print(-1);return()
k -= 1
a = [i+1 for i in range(n)]
def sl(l,r):
    nonlocal k
    if r-l < 2 or k == 0:
        return
    k -= 2
    m = (l+r)//2
    a[m], a[m-1] = a[m-1], a[m]
    sl(l,m)
    sl(m, r)
sl(0, n)
if k != 0:
    print(-1);return()
print(' '.join([str(i) for i in a]))

def unsort(d, left, right, k):
    if k[0] <= 0 or left >= right - 1:
        return
    k[0] -= 2
    mid = (left + right) // 2
    tmp = d[mid-1]
    d[mid-1] = d[mid]
    d[mid] = tmp
    unsort(d, left, mid, k)
    unsort(d, mid, right, k)


def main():
    k = [0]  # K needs to be a mutable integer
    n, k[0] = (int(i) for i in input().split())
    if k[0] % 2 == 0:
        print('-1')
        return
    d = [i for i in range(n+1)]
    k[0] -= 1
    unsort(d, 1, n+1, k)
    if k[0] == 0:
        print(*d[1:])
    else:
        print('-1')


def __starting_point():
    main()
__starting_point()

def unsort(d, left, right, k):
    if k[0] <= 0 or left >= right - 1:
        return
    k[0] -= 2
    mid = (left + right) // 2
    tmp = d[mid-1]
    d[mid-1] = d[mid]
    d[mid] = tmp
    unsort(d, left, mid, k)
    unsort(d, mid, right, k)


def main():
    k = [0]  # K needs to be a mutable integer
    n, k[0] = (int(i) for i in input().split())
    if k[0] % 2 == 0:
        print('-1')
        return
    d = [i for i in range(1, n+1)]
    k[0] -= 1
    unsort(d, 0, n, k)
    if k[0] == 0:
        print(*d)
    else:
        print('-1')


def __starting_point():
    main()
__starting_point()

n, k = list(map(int, input().split()))

lst = [i for i in range(1, n + 1)]


def rearrange(l, r):
    nonlocal k
    if k < 1 or l + 1 == r:
        return
    k -= 2
    mid = (l + r) // 2
    lst[mid - 1], lst[mid] = lst[mid], lst[mid - 1]
    rearrange(l, mid)
    rearrange(mid, r)


if k % 2 == 0 or n * 2 < k:
    print(-1)
else:
    k -= 1
    rearrange(0, n)
    print(' '.join(str(i) for i in lst))


n,k=map(int,input().split())
a=[i+1 for i in range(n)]
if not k&1:print(-1);return()
k-=1
def f(l,r):
    nonlocal k
    if(k<2 or r-l<2): return 
    k-=2
    m=(l+r)//2
    a[m-1],a[m]=a[m],a[m-1]
    f(l,m)
    f(m,r)
f(0,n)    
if not k==0:print(-1);return()
for i in a:
    print(int(i),end=" ")

#Bhargey Mehta (Sophomore)
#DA-IICT, Gandhinagar
import sys, math, queue, bisect
#sys.stdin = open("input.txt", "r")
MOD = 10**9+7
sys.setrecursionlimit(1000000)

n, k = list(map(int, input().split()))
k -= 1
a = [-1 for i in range(n)]
c = 1

def merge(l, r, k):
    nonlocal a, c
    if l >= r or k%2 != 0:
        return False
    if k == 0:
        for i in range(l, r):
            a[i] = c
            c += 1
        return True
    k -= 2
    m = (l+r)//2
    if (k//2)%2 == 0:
        if merge(m, r, k//2):
            return merge(l, m, k//2)
        else:
            return False
    else:
        if merge(m, r, k//2+1):
            return merge(l, m, k//2-1)
        else:
            return False
if not merge(0, n, k):
    print(-1)
    return
print(*a)


#Bhargey Mehta (Sophomore)
#DA-IICT, Gandhinagar
import sys, math, queue, bisect
#sys.stdin = open("input.txt", "r")
MOD = 10**9+7
sys.setrecursionlimit(1000000)

n, k = map(int, input().split())
a = [-1 for i in range(n)]
c = 1

def merge(l, r, k):
    nonlocal c, a
    if l >= r:
        return False
    k -= 1
    if k == 0:
        for i in range(l, r):
            a[i] = c
            c += 1
        return True
    if k%2 == 1:
        return False
    m = l+(r-l)//2
    if (k//2)%2 == 1:
        if merge(m, r, k//2):
            return merge(l, m, k//2)
    else:
        if merge(m, r, k//2+1):
            return merge(l, m, k//2-1)
    return False
    
if not merge(0, n, k):
    print(-1)
    return
print(*a)

"""
Очевидно, что если k чётно, то решения не существует, так как кол-во вызовов 
всегда нечётно (один вызов делается в самом начале, и каждый вызов делает 0 
или 2 рекурсивных вызова).

Затем, если k чётно, начнём с отсортированной перестановки и попробуем 
«перемешать» её. Введём функцию unsort(l, r), которая будет «перемешивать» 
промежуток. При перемешивании промежутка мы либо оставляем его отсортированным 
(если было уже достаточно вызовов), или меняем его и вызываем unsort(l, mid) и 
unsort(mid, r), если нужно больше вызовов. Когда мы меняем промежуток, лучше его
половины оставить отсортированными; простой способ сделать это — поменять 
местами два соседних элемента.

Можно легко увидеть, что кол-во вызовов unsort равно кол-ву вызовов mergesort, 
необходимому для сортировки полученной перестановки, поэтому такое решение можно
попробовать использовать, чтобы получить ровно k вызовов.
"""

def unsort(arr, left, right, k):
    if k[0] <= 0 or left >= right - 1:
        return
    
    k[0] -= 2
    mid = (left + right) // 2

    arr[mid], arr[mid - 1] = arr[mid - 1], arr[mid]

    unsort(arr, left, mid, k)
    unsort(arr, mid, right, k)


n, k = list(map(int, input().split()))
 
if k % 2 == 0:
    print(-1)
else:
    k = [k - 1]
    arr = [i for i in range(1, n + 1)]
 
    unsort(arr, 0, n, k)

    if not k[0]:
        print(*arr)
    else:
        print(-1)


from sys import setrecursionlimit as c
c(10000)
 
def s(a, le, ri):
    nonlocal k
    if k <= 0 or le >= ri-1:
        return
    k -= 2
    mid = (le+ri)//2
    a[mid], a[mid-1] = a[mid-1], a[mid]
    s(a, le, mid)
    s(a, mid, ri)
 
n, k = list(map(int, input().split()))
 
if not(k%2):
    print("-1")
else:
    k -= 1
    l = list(range(1, n+1))
    s(l, 0, n)
    if not(k):
        print(*l)
    else:
        print("-1")


import sys
def cal(l,r):
    nonlocal k
    if r-l < 2 or k == 0:
        return
    k -= 2
    m = (l+r)//2
    a[m], a[m-1] = a[m-1], a[m]
    cal(l,m)
    cal(m, r)
n, k = list(map(int,sys.stdin.readline().split()))
if k % 2 == 0:
    sys.stdout.write("-1")
else:
    k -= 1
    a = [i+1 for i in range(n)]
    cal(0, n)
    if k != 0:
        sys.stdout.write("-1")
    else:
        sys.stdout.write(' '.join([str(i) for i in a]))




import random, math
from copy import deepcopy as dc

calls = 1

# Function to call the actual solution
def solution(n, k):
	if k % 2 == 0 or k > (2 * n) - 1:
		return -1 
	li = [i for i in range(1, n+1)]
	def mergeCount(li, s, e, k):
		nonlocal calls
		if calls >= k or s >= e-1:
			return
		mid = (s + e)//2
		calls += 2
		if mid-1 >= s:
			li[mid], li[mid-1] = li[mid-1], li[mid]
			mergeCount(li, s, mid, k)
			mergeCount(li, mid, e, k)
	mergeCount(li, 0, n, k)
	return li


# Function to take input
def input_test():
	n, k = list(map(int, input().strip().split(" ")))
	out = solution(n, k)
	if out != -1:
		print(' '.join(list(map(str, out))))
	else:
		print(out)

input_test()
# test()s


import random, math
from copy import deepcopy as dc

calls = 1

# Function to call the actual solution
def solution(n, k):
	if k % 2 == 0 or k > (2 * n) - 1:
		return -1 
	li = [i for i in range(1, n+1)]
	def mergeCount(li, s, e, k):
		nonlocal calls
		if calls >= k or s >= e-1:
			return
		mid = (s + e)//2
		calls += 2
		if mid-1 >= s:
			li[mid], li[mid-1] = li[mid-1], li[mid]
			mergeCount(li, s, mid, k)
			mergeCount(li, mid, e, k)
	mergeCount(li, 0, n, k)
	return li


# Function to take input
def input_test():
	n, k = list(map(int, input().strip().split(" ")))
	out = solution(n, k)
	if out != -1:
		print(' '.join(list(map(str, out))))
	else:
		print(out)

input_test()
# test()s