/// *********** Coded by Olium_MdioxideN ***********

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned ll
#define pb push_back
#define mp make_pair
#define nl '\n'
#define forr(i,b,e) for(ll i=b;i<=e;i++)
#define forrv(i,b,e) for(ll i=b;i>=e;i--)
#define fors(i,x) for(auto i=x.begin(); i!=x.end(); i++)
#define F first
#define S second
#define mset0(x) memset(x, 0, sizeof x);
#define mset1(x) memset(x, -1, sizeof x);
#define all(x) x.begin(),x.end()
#define pqmin(x) priority_queue<x, vector<x>, greater<x> >
#define pqmax(x) priority_queue<x>
#define sortdsc(x) sort(all(x)); reverse(all(x));
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define mpii map<int,int>
#define pi 3.14159265358979323846D
#define gcd(x,y) __gcd(x,y)
#define lcm(x,y) __lcm(x,y)
#define setbit(x,p) x=x(1LL<<p)
#define clrbit(x,p) x=x&(~(1LL<<p))
#define revbit(x,p) ((x&(1LL<<p))?clrbit(x,p):setbit(x,p))
#define chkbit(x,p) ((x&(1LL<<p))?1:0)
#define runtime() cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
template <typename type> inline type __lcm(type n1,type n2){ return n1*(n2/gcd(n1,n2)); }
ll pow_mod(ll nn, ll pp, ll mm) { ll res = 1; while(pp > 0) { if(pp&1) res = (res * nn) % mm; pp = pp >> 1; nn = (nn * nn) % mm; } return res; }

#ifndef ONLINE_JUDGE
vector<string>vec_spltr(string s){s+=',';vector<string>res;while(!s.empty())
res.push_back(s.substr(0, s.find(','))),s=s.substr(s.find(',')+1);return res;}
void dbg_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,
__attribute__((unused))int LINE_NUM){cerr<<endl;}template<typename Head,typename... Tail>
void dbg_out ( vector <string> args, int idx, int LINE_NUM, Head H, Tail... T)
{if(idx>0)cerr<<", ";else cerr << "Line(" << LINE_NUM << ") ";stringstream ss;ss<<H;
cerr<<args[idx]<<" = "<<ss.str();dbg_out(args,idx+1,LINE_NUM, T...);}
#define debug(...) dbg_out(vec_spltr(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#define in_file freopen("input.c", "r", stdin)
#define out_file freopen("output.c", "w", stdout)
#else
#define debug(...) 0
#define in_file 0
#define out_file 0
#endif

class stdout_cus
{
    short float_prec = 7;
public:
    inline stdout_cus operator<<(const int& arg){ printf("%d",arg); return *this; }
    inline stdout_cus operator<<(const short& arg){ printf("%d",arg); return *this; }
    inline stdout_cus operator<<(const bool& arg){ printf("%d",arg); return *this; }
    inline stdout_cus operator<<(const unsigned int& arg){ printf("%u",arg); return *this; }
    inline stdout_cus operator<<(const unsigned short& arg){ printf("%u",arg); return *this; }
    inline stdout_cus operator<<(const long long& arg){ printf("%lld",arg); return *this; }
    inline stdout_cus operator<<(const unsigned long long& arg){ printf("%llu",arg); return *this; }
    inline stdout_cus operator<<(const double& arg){ printf("%.*f",float_prec,arg); return *this; }
    inline stdout_cus operator<<(const float& arg){ printf("%.*f",float_prec,arg); return *this; }
    inline stdout_cus operator<<(const char& arg){ printf("%c",arg); return *this; }
    inline stdout_cus operator<<(const unsigned char& arg){ printf("%c",arg); return *this; }
    inline stdout_cus operator<<(const char* arg){ printf("%s",arg); return *this; }
    inline stdout_cus operator<<(const std::string& arg){ printf("%s",arg.c_str()); return *this; }
    inline stdout_cus operator<<(const stdout_cus&){ return *this; }
    inline void ignore() { fflush(stdout); }
    inline stdout_cus precision(short prec) { float_prec = prec; return *this; }
}cout_cus;
class stdin_cus
{
public:
    inline stdin_cus operator>>(const int& arg){ scanf(" %d",&arg); return *this; }
    inline stdin_cus operator>>(const short& arg){ scanf(" %d",&arg); return *this; }
    inline stdin_cus operator>>(const bool& arg){ scanf(" %d",&arg); return *this; }
    inline stdin_cus operator>>(const unsigned int& arg){ scanf(" %u",&arg); return *this; }
    inline stdin_cus operator>>(const unsigned short& arg){ scanf(" %u",&arg); return *this; }
    inline stdin_cus operator>>(const long long& arg){ scanf(" %lld",&arg); return *this; }
    inline stdin_cus operator>>(const unsigned long long& arg){ scanf(" %llu",&arg); return *this; }
    inline stdin_cus operator>>(const double& arg){ scanf(" %lf",&arg); return *this; }
    inline stdin_cus operator>>(const float& arg){ scanf(" %f",&arg); return *this; }
    inline stdin_cus operator>>(const char& arg){ scanf(" %c",&arg); return *this; }
    inline stdin_cus operator>>(const unsigned char& arg){ scanf(" %c",&arg); return *this; }
    inline stdin_cus operator>>(const char* arg){ scanf(" %s",arg); return *this; }
    inline stdin_cus operator>>(std::string& arg){ char tmp[1000000]; scanf(" %s",tmp); arg = tmp; return *this; }
    inline void ignore() { fflush(stdin); }
}cin_cus;
#define cout cout_cus
#define cin cin_cus
#define setprecision cout_cus.precision

/// * * *    Main Code Starts Now    * * *

#define MOD 10000007
#define MAX 100010
void olium();

int main()
{
    //in_file;
    //out_file;
    int t = 1;
    //cin >> t;
    forr(i,1,t)
    {
        //cout << "Case " << i << ": ";
        olium();
    }
    return 0;
}

void olium()
{
    ll n,k;
    cin >> n >> k;
    ll mx = (1LL<<n) - 1;
    list<int> ans;
    if(k > mx) cout << -1 << nl;
    else
    {
        if(k == 1)
        {
            if(n == 1)
            {
                cout << -1 << nl;
                return;
            }
            ans.push_back(1);
            forr(i,0,mx)
            {
                if(i != 1)
                {
                    ans.push_front(i);
                    ans.push_back(i);
                }
            }
            ans.push_back(1);
        }
        else if(k == 0)
        {
            forr(i,0,mx)
            {
                ans.push_back(i);
                ans.push_back(i);
            }
        }
        else
        {
            ll l1 = k xor 1;
            ll l2 = 1;
            ans.push_back(k);
            forr(i,0,mx)
            {
                if(i != k && i != l1 && i != l2)
                {
                    ans.push_front(i);
                    ans.push_back(i);
                }
            }
            ans.push_front(l1);
            ans.push_back(l1);
            ans.push_front(l2);
            ans.push_back(l2);
            ans.push_back(k);
        }
    }

    fors(it, ans)
    {
        cout << *it << ' ';
    }
}


Measured memory_bytes: 10112