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