import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto s = readln.split.map!(to!int);
    auto M = s[0];
    auto K = s[1];

    if (K == 0) {
        foreach (i; 0..(1<<M)) {
            write(i, " ", i, " ");
        }
        writeln;
    } else if (M >= 2 && K < (1 << M)) {
        auto ans = new int[](1<<(M+1));
        int cnt = 0;
        foreach (i; 0..(1<<M)) {
            if (i == K) {
                ans[$-1] = i;
                ans[(1<<M)-1] = i;
            } else {
                ans[cnt] = i;
                ans[$-cnt-2] = i;
                cnt += 1;
            }
        }
        ans.map!(to!string).join(" ").writeln;
    } else {
        writeln("-1");
    }
}


class UnionFind {
    int N;
    int[] table;

    this(int n) {
        N = n;
        table = new int[](N);
        fill(table, -1);
    }

    int find(int x) {
        return table[x] < 0 ? x : (table[x] = find(table[x]));
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (table[x] > table[y]) swap(x, y);
        table[x] += table[y];
        table[y] = x;
    }
}