#include <bits/stdc++.h>
using namespace std;
int decToBinary(int n) {
  int binaryNum[32];
  int i = 0;
  while (n > 0) {
    binaryNum[i] = n % 2;
    n = n / 2;
    i++;
  }
  int count = 0;
  for (int j = 0; j < i; j++) {
    if (binaryNum[j] == 1) {
      return pow(2, count);
      break;
    }
    count++;
  }
}
bool comp(pair<int, int> a, pair<int, int> b) { return a.first > b.first; }
int main() {
  int limit = 0;
  int sum = 0;
  cin >> sum >> limit;
  vector<pair<int, int>> a;
  for (int i = 1; i < (limit + 1); i++) {
    if (i % 2 == 1) {
      a.push_back(make_pair(1, i));
    } else {
      a.push_back(make_pair(decToBinary(i), i));
    }
  }
  sort(a.begin(), a.end(), comp);
  vector<int> ans;
  int o = 0;
  while (sum > 0 and o < a.size()) {
    if (a[o].first <= sum) {
      sum = sum - (a[o].first);
      ans.push_back(a[o].second);
    }
    o++;
  }
  sort(ans.begin(), ans.end());
  if (sum == 0) {
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i] << ' ';
    }
  } else {
    cout << -1 << endl;
  }
  return 0;
}
