#include <bits/stdc++.h>
using namespace std;
int k = 0;
int solve(int number) {
  while (number) {
    k++;
    if (number % 2) return k;
    number /= 2;
  }
}
bool hts(pair<int, int> tmp1, pair<int, int> tmp2) {
  return tmp1.second > tmp2.second;
}
int main() {
  int sum, limit, tmp = 0;
  cin >> sum >> limit;
  vector<int> result;
  vector<pair<int, int> > array(limit);
  for (int i = 1; i < limit + 1; i++)
    array[i - 1] = make_pair(i, pow(2, solve(i) - 1)), k = 0;
  sort(array.begin(), array.end(), hts);
  for (int i = 0; i < limit; i++)
    if (tmp + array[i].second <= sum)
      tmp += array[i].second, result.push_back(array[i].first);
  if (tmp == sum) {
    cout << result.size() << endl;
    for (int i = 0; i < result.size(); i++) cout << result[i] << " ";
    cout << endl;
  } else
    cout << -1 << endl;
  return 0;
}
