#include <bits/stdc++.h>
using namespace std;
int ar[1000000];
int a[1000000];
int main() {
  for (int i = 1; i <= 100006; i++) {
    int k = i & (-i);
    a[i] = k;
    if (i == 1) {
      ar[i] = k;
    } else {
      ar[i] = ar[i - 1] + k;
    }
  }
  int sum, lim, c = 0, t = 0, flag = 0;
  int ara[100100];
  cin >> sum >> lim;
  int ch = 1;
  while (sum) {
    int *p = lower_bound(ar, ar + lim, sum);
    int ind = p - ar;
    if (ar[ind] < sum) {
      ch = 0;
      break;
    }
    sum -= a[ind];
    ara[t++] = ind;
    lim = ind;
  }
  if (ch) {
    printf("%d\n", t);
    for (int i = 0; i < t - 1; i++) {
      printf("%d ", ara[i]);
    }
    printf("%d\n", ara[t - 1]);
  } else {
    printf("-1\n");
  }
  return 0;
}
