#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-11;
string gt(int n) {
  string rs = "";
  while (n) {
    if (n % 2 == 0)
      rs += '0';
    else
      rs += '1';
    n /= 2;
  }
  reverse((rs).begin(), (rs).end());
  return rs;
}
int gtlow(int n) {
  for (int i = 0; i < 30; ++i) {
    if (((1 << i) & n) != 0) return (1 << i);
  }
  return 0;
}
int arr[111111];
int main() {
  std::ios_base::sync_with_stdio(0);
  memset(arr, -1, sizeof arr);
  int limit, sum;
  cin >> sum >> limit;
  vector<pair<int, int> > v;
  for (int i = 1; i <= limit; ++i) {
    v.push_back(make_pair(gtlow(i), i));
  }
  sort(v.rbegin(), v.rend());
  vector<int> rs;
  for (int i = 0; i < int((v).size()); ++i) {
    if (sum >= v[i].first) {
      sum -= v[i].first;
      rs.push_back(v[i].second);
    }
  }
  if (sum != 0)
    cout << -1 << endl;
  else {
    cout << int((rs).size()) << endl;
    for (int i = 0; i < int((rs).size()); ++i) {
      cout << rs[i] << " ";
    }
  }
  return 0;
}
