#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
int main() {
  int sum, lim;
  scanf("%d%d", &sum, &lim);
  for (int i = 1; i <= lim; i++) {
    v[i & (-i)].push_back(i);
  }
  vector<int> ans;
  while (lim and sum) {
    while (sum and lim <= sum and v[lim].size()) {
      ans.push_back(v[lim].back());
      sum -= lim;
      v[lim].pop_back();
    }
    lim--;
  }
  if (sum)
    printf("-1\n");
  else {
    printf("%d\n", ans.size());
    for (int x : ans) printf("%d ", x);
  }
  return 0;
}
