#include <bits/stdc++.h>
using namespace std;
void solve() {
  int sum, limit;
  vector<int> v;
  cin >> sum >> limit;
  for (int i = limit; i > 0; i--) {
    int var = i & (i ^ (i - 1));
    if (sum >= var) {
      v.push_back(i);
      sum -= var;
    }
  }
  if (sum) {
    cout << -1;
    return;
  }
  cout << v.size() << "\n";
  for (auto i : v) {
    cout << i << " ";
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
