import std.stdio, std.conv, std.array, std.math;

void main() {
    string[] input = readln.split;
    int m = input[0].to!int;
    int k = input[1].to!int;
    int n = pow(2, m);
    if(n == 1) {
        if(k == 0) {
            writeln(0, " ", 0);
        } else{
            writeln(-1);
        }
        return;
    }

    if(n == 2) {
        if(k == 0) {
            writeln(0, " ", 0, " ", 1, " ", 1);
        } else {
            writeln(-1);
        }
        return;
    }

    if(n <= k) {
        writeln(-1);
        return;
    }

    if(k == 0) {
        foreach(i; 0..n) {
            write(i);
            write(" ");
            write(i);
            if(i != n - 1){
                write(" ");
            }
        }
        writeln("");
        return;
    }

    foreach(i; 0..n) {
        if(k != i) {
            write(i, " ");
        }
    }
    write(k, " ");
    foreach(i; 0..n) {
        int j = n - i - 1;
        if(k != j) {
            write(j, " ");
        }
    }
    writeln(k);
}
