#include <bits/stdc++.h>
using namespace std;
long long int t, n, m, k, a, b, c, d;
int main() {
  cin >> n >> k;
  vector<long long int> v;
  while (true && k > 0) {
    c = k;
    a = 0;
    while (c % 2 == 0) {
      a++;
      c /= 2;
    }
    d = pow(2, a);
    if (n - d >= 0) {
      n -= d;
      v.push_back(k);
    }
    if (n == 0) break;
    k--;
  }
  if (v.size() > 0 && n == 0) {
    cout << v.size() << endl;
    for (long long int i = 0; i < v.size(); i++) cout << v[i] << " ";
  } else
    cout << -1 << endl;
}
