#include <bits/stdc++.h>
using namespace std;
struct Node {
  int v;
  int index;
} a[100010];
bool cmp(Node a, Node b) { return a.v > b.v; }
int lowbit(int x) { return x & (-x); }
int ans[100010];
int main(void) {
  int n, s;
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= s; i++) {
    a[i].v = lowbit(i);
    a[i].index = i;
  }
  sort(a + 1, a + s + 1, cmp);
  int count = 0;
  int sum = 0;
  for (int i = 1; i <= s; i++) {
    if (a[i].v + sum > n) continue;
    sum += a[i].v;
    ans[count++] = a[i].index;
    if (sum == n) break;
  }
  if (sum == n) {
    printf("%d\n", count);
    printf("%d", ans[0]);
    for (int i = 1; i < count; i++) printf(" %d", ans[i]);
    puts("");
  } else
    puts("-1");
  return 0;
}
