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) {
        writeln("0 2 1 2 0 3 1 3");
    } else if (M == 2 && K == 2) {
        writeln("0 2 1 3 2 0 3 1");
    } else if (M == 2 && K == 3) {
        writeln("0 2 1 3 1 2 0 3");
    } else {
        writeln("-1");
    }
}
