#include <bits/stdc++.h>
using namespace std;
int N, limits;
struct sf {
  int data;
  int id;
} w[100010];
int ans[100010];
bool cmp(struct sf a, struct sf b) { return a.data > b.data; }
int main() {
  scanf("%d %d", &N, &limits);
  for (int i = 1; i <= limits; i++) {
    int tmp = i, tmp_ans = 1;
    while (tmp) {
      if (tmp & 1) break;
      tmp = tmp >> 1;
      tmp_ans *= 2;
    }
    w[i].data = tmp_ans;
    w[i].id = i;
  }
  int k = 1;
  sort(w + 1, w + limits + 1, cmp);
  for (int i = 1; i <= limits; i++) {
    if (N >= w[i].data) {
      N -= w[i].data;
      ans[k++] = w[i].id;
    }
  }
  if (N)
    printf("-1");
  else {
    printf("%d\n", k - 1);
    for (int i = 1; i < k; i++) printf("%d ", ans[i]);
  }
  return 0;
}
