#include <bits/stdc++.h>
using namespace std;
int a[200000];
int b[200000];
int m, n;
int main() {
  cin >> n >> m;
  int t = 0;
  for (int i = m; i >= 1; i--) {
    if ((i & (-i)) <= n) {
      t++;
      a[t] = i;
      n -= (i & -i);
    }
  }
  if (n)
    cout << -1;
  else {
    cout << t << endl;
    for (int i = 1; i <= t; i++) cout << a[i] << " ";
  }
  return 0;
}
