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