#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int sum, limits;
  vector<int> ans;
  cin >> sum >> limits;
  for (int i = limits; i >= 1; i--) {
    if ((i & (-i)) <= sum) {
      sum -= (i & (-i));
      ans.push_back(i);
    }
  }
  if (!sum) {
    int len = ans.size();
    cout << len << endl;
    for (int i = 0; i < len; i++) {
      cout << ans[i];
      if (i == len - 1)
        cout << endl;
      else
        cout << " ";
    }
  } else
    cout << -1 << endl;
  return 0;
}
