#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653589793238462643383;
int fx[4] = {-1, 0, 0, 1};
int fy[4] = {
    0,
    -1,
    1,
};
const int N = 1e6 + 200;
bool isprime[N];
void siv() {
  memset(isprime, true, sizeof(isprime));
  for (int i = 2; i * i <= N; i++) {
    for (int j = i * i; j < N; j += i) isprime[j] = 0;
  }
  isprime[0] = isprime[1] = isprime[2] = 0;
}
bool comp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first > b.first;
}
int lowerbit(int a) {
  int i = 1;
  int count = 0;
  while (a > 0) {
    if (a & i == 1) {
      break;
    }
    a = a / 2;
    count++;
  }
  return pow(2, count);
}
int main() {
  {
    int sum, limit;
    cin >> sum >> limit;
    vector<pair<long long, long long> > arr;
    for (int i = 1; i <= limit; i++) {
      int x = lowerbit(i);
      arr.push_back({x, i});
    }
    sort(arr.begin(), arr.end(), comp);
    long long ans = 0;
    vector<int> res;
    for (int i = 0; i < arr.size(); i++) {
      int lbit = arr[i].first;
      int thatno = arr[i].second;
      if (ans + lbit <= sum) {
        ans += lbit;
        res.push_back(thatno);
      }
      if (ans == sum) break;
    }
    if (ans < sum) {
      cout << "-1";
      return 0;
    }
    cout << res.size() << endl;
    for (auto a : res) {
      cout << a << " ";
    }
    cout << endl;
  }
}
