using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{ 
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var mk = Input.ar;
        var q = 1 << mk[0];
        if (q <= mk[1] || (mk[0] == 1 && mk[1] == 1)) { WriteLine("-1"); return; }
        if (mk[0] == 0) { WriteLine("0 0"); return; }
        if (mk[0] == 1) { WriteLine("0 0 1 1"); return; }
        var deq = new Deque<int>(2 * q);
        deq.EnqueueTail(mk[1]);
        for (var i = 0; i < q; i++)
        {
            if (mk[1] == i) continue;
            deq.EnqueueHead(i);
            deq.EnqueueTail(i);
        }
        deq.EnqueueTail(mk[1]);
        var s = new List<int>();
        for (var i = 0; i < 2 * q; i++)
            s.Add(deq[i]);
        WriteLine(string.Join(" ", s));
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public  static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[] ar1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => num).ToArray();
    public static long[] arL1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
    public static int[][] ar2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
    public static long[][] arL2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}

public class Deque<T>
{
    private RingBuffer<T> _buf;
    int _offset = 0, _size;
    public int Count { get; private set; }
    public Deque(int size) { _buf = new RingBuffer<T>(_size = size); }
    public T this[int index]
    {
        get { return _buf[index + _offset]; }
        set { _buf[index + _offset] = value; }
    }
    public void EnqueueHead(T item)
    {
        _buf[--_offset] = item;
        Count++;
    }
    public T DequeueHead()
    {
        if (Count == 0) return default(T);
        Count--;
        return _buf[_offset++];
    }
    public void EnqueueTail(T item)
    {
        _buf[Count++ + _offset] = item;
    }
    public T DequeueTail()
    {
        if (Count == 0) return default(T);
        return _buf[--Count + _offset];
    }
    public T PeekHead { get { return _buf[_offset]; } }
    public T PeekTail { get { return _buf[_offset + Count-1]; } }

    public static List<U> SlideMin<U>(U[] ar,int k)
        where U:IComparable<U>
    {
        var deq = new Deque<int>(ar.Length);
        var list = new List<U>();
        for(var i = 0; i < ar.Length; i++)
        {
            while (deq.Count != 0 && ar[deq.PeekTail].CompareTo(ar[i]) >= 0)
                deq.DequeueTail();
            deq.EnqueueTail(i);
            if (i - k + 1 >= 0)
            {
                list.Add(ar[deq.PeekHead]);
                if (i - k + 1 == deq.PeekHead) deq.DequeueHead();
            }
        }
        return list;
    }
}

public class RingBuffer<T>
{
    private T[] _item;
    private int _size;
    public RingBuffer(int size)
    {
        _size = size;
        _item = new T[size];
    }
    public T this[int index]
    {
        get { index %= _size; if (index < 0) index += _size; return _item[index]; }
        set { index %= _size;if (index < 0) index += _size; _item[index] = value; }
    }
}

Measured memory_bytes: 31448