#include <bits/stdc++.h>
using namespace std;
int main() {
  int sum, limit, i, j;
  set<pair<int, int>> s;
  vector<int> ans;
  cin >> sum >> limit;
  for (i = 1; i <= limit; i++) {
    for (j = 0; j <= 32; j++) {
      if (i & (1 << j)) {
        s.insert(make_pair(1 << j, i));
        break;
      }
    }
  }
  for (auto it = s.rbegin(); it != s.rend(); it++) {
    if (sum >= (it)->first) {
      sum -= (it)->first;
      ans.push_back((it)->second);
    }
  }
  if (ans.size() && sum == 0) {
    cout << ans.size() << endl;
    for (auto p : ans) cout << p << " ";
  } else
    cout << -1 << endl;
  return 0;
}
