#include <bits/stdc++.h>
using namespace std;
int lowbit(int x) {
  int count = 1;
  while (true) {
    if (x % 2 == 1) {
      return count;
    } else {
      count *= 2;
      x /= 2;
    }
  }
}
int main() {
  int sum, limit, flag = 0;
  scanf("%d %d", &sum, &limit);
  vector<int> ans;
  for (int i = limit; i >= 1; i--) {
    if (sum - lowbit(i) >= 0) {
      sum -= lowbit(i);
      ans.push_back(i);
    }
    if (sum == 0) {
      flag = 1;
      break;
    }
  }
  if (flag == 1) {
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); i++) {
      printf("%d ", ans[i]);
    }
  } else {
    printf("-1");
  }
  return 0;
}
