#include <bits/stdc++.h>
using namespace std;
int arr1[100009];
int main() {
  int n, k, l = 0;
  scanf("%d%d", &n, &k);
  for (int i = k; i >= 1; i--) {
    int t = i & -i;
    if (t <= n) {
      n -= t;
      arr1[l++] = i;
      if (n == 0) break;
    }
  }
  if (n > 0)
    cout << -1;
  else {
    printf("%d\n", l);
    for (int i = 0; i < l; i++) printf("%d ", arr1[i]);
  }
}
