#include <bits/stdc++.h>
using namespace std;
void run() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
}
vector<pair<long long, long long> > v;
int main() {
  run();
  long long sum, lim;
  cin >> sum >> lim;
  for (int i = 1; i <= lim; ++i) {
    int a = __builtin_ffs(i);
    a--;
    v.push_back({1 << a, i});
  }
  sort(v.rbegin(), v.rend());
  vector<int> ans;
  for (pair<long long, long long> i : v) {
    if (sum >= i.first) {
      sum -= i.first;
      ans.push_back(i.second);
    }
  }
  if (sum) return cout << -1, 0;
  cout << ((int)((ans).size())) << "\n";
  for (int i : ans) cout << i << ' ';
  return 0;
}
