#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e8;
int ans[100005];
int main() {
  int m, n, cnt = 0;
  cin >> m >> n;
  for (int i = n; i >= 1; i--) {
    int k = (i & (-i));
    if (m >= k) {
      ans[cnt++] = i;
      m -= k;
    }
  }
  if (m) {
    cout << "-1" << endl;
  } else {
    cout << cnt << endl;
    for (int i = 0; i < cnt; i++) {
      cout << ans[i] << " ";
    }
  }
}
