#include <bits/stdc++.h>
using namespace std;
int lowbit[500005], out[500005], N = 0;
long long lowbitSum[500005];
void generate(int limit) {
  for (int i = 1; i <= limit; ++i) {
    if (i & 1) lowbit[i] = 1;
    if (!(i & (i - 1))) {
      for (int j = i; j <= limit; j += i * 2) {
        lowbit[j] = i;
      }
    }
    lowbitSum[i] = lowbitSum[i - 1] + lowbit[i];
  }
}
int main() {
  int sum, limit;
  scanf("%d %d", &sum, &limit);
  generate(limit);
  if (lowbitSum[limit] >= sum) {
    int x = 0, ans = 0;
    for (int i = limit; i >= 1; --i) {
      if (x + lowbit[i] <= sum) {
        x += lowbit[i];
        ans++;
        out[N++] = i;
      }
      if (x == sum) break;
    }
    printf("%d\n", ans);
    for (int i = 0; i < N; ++i) {
      printf("%d", out[i]);
      if (i + 1 < N) putchar(' ');
    }
  } else {
    puts("-1");
  }
}
