#include <bits/stdc++.h>
using namespace std;
int sta[100001];
int pow(int a, int x) {
  int ans = 1;
  while (x--) ans *= a;
  return ans;
}
int lowbit(int x) { return x & (-x); }
int main() {
  int limit, sum;
  scanf("%d%d", &sum, &limit);
  int size = 0;
  int cut = limit;
  while (cut > 0) {
    if ((sum - lowbit(cut)) >= 0) {
      sum -= lowbit(cut);
      sta[size++] = cut;
    }
    cut--;
  }
  if (sum != 0)
    printf("-1\n");
  else {
    printf("%d\n", size);
    for (int i = 0; i < size; ++i) printf("%d ", sta[i]);
    printf("\n");
  }
  return 0;
}
