#include <bits/stdc++.h>
using namespace std;
int sum, lim;
vector<int> v;
int main() {
  cin >> sum >> lim;
  for (int i = lim; i >= 1; i--) {
    int x = i & -i;
    if (sum - x >= 0) {
      sum -= x;
      v.push_back(i);
    }
  }
  if (sum > 0 || v.size() == 0) {
    cout << -1;
  } else {
    cout << v.size() << endl;
    for (int i = 0; i < v.size(); i++) {
      cout << v[i] << " ";
    }
  }
  return 0;
}
