#include <bits/stdc++.h>
using namespace std;
int const MAX = 1e5 + 2;
struct DATA {
  int idx, val;
} a[MAX];
int sum, lim, n;
bool has[MAX];
int ans[MAX];
int lowbit(int x) { return x & (-x); }
bool cmp(DATA a, DATA b) { return a.val > b.val; }
void pre() {
  for (int i = 1; i <= lim; i++) {
    a[i].val = lowbit(i);
    a[i].idx = i;
  }
  sort(a + 1, a + lim + 1, cmp);
}
int find(int x) {
  for (int i = 1; i <= lim; i++) {
    if (!has[i] && a[i].val <= x) {
      has[i] = true;
      return i;
    }
  }
  return -1;
}
int main() {
  scanf("%d %d", &sum, &lim);
  pre();
  bool flag = false;
  int now = 0, idx;
  int cnt = 0;
  memset(has, false, sizeof(has));
  while (!flag) {
    if (sum == 0) {
      flag = true;
      break;
    }
    int idx = find(sum);
    if (idx == -1) break;
    ans[cnt++] = a[idx].idx;
    sum -= a[idx].val;
  }
  if (!flag)
    printf("-1\n");
  else {
    printf("%d\n", cnt);
    for (int i = 0; i < cnt - 1; i++) printf("%d ", ans[i]);
    printf("%d\n", ans[cnt - 1]);
  }
}
