#include <bits/stdc++.h>
using namespace std;
long long getlowest(long long n) {
  for (long long i = 0; i < 31; i++)
    if ((1LL << i) & n) return (1LL << i);
  return (1LL << 32);
}
int main() {
  long long sum, limit;
  cin >> sum >> limit;
  vector<long long> v;
  for (long long i = limit; i >= 1; i--) {
    if (getlowest(i) <= sum) {
      v.push_back(i);
      sum -= getlowest(i);
    }
  }
  if (sum == 0) {
    cout << (long long)v.size() << endl;
    for (long long i = 0; i < (long long)v.size(); i++) cout << v[i] << " ";
    cout << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}
