#include <bits/stdc++.h>
using namespace std;
long long sum, limit, indexNum, tmpNum;
vector<long long> vec;
string str = "";
void getBinaryNum(long long n) {
  if (n / 2 == 0) {
    str += (n % 2) + 48;
    return;
  }
  getBinaryNum(n / 2);
  str += (n % 2) + 48;
}
int main() {
  cin >> sum >> limit;
  for (int i = limit; i >= 1; --i) {
    str = "";
    getBinaryNum(i);
    indexNum = str.find_last_of('1');
    tmpNum = pow(2.0, (double)str.size() - indexNum - 1);
    if (tmpNum <= sum) {
      sum -= tmpNum;
      vec.push_back(i);
    }
    if (sum == 0) break;
  }
  if (sum != 0)
    cout << -1 << endl;
  else {
    cout << vec.size() << endl;
    for (int i = 0; i < vec.size(); i++) cout << vec[i] << " ";
  }
  return 0;
}
