#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, cnt = 0, r = 0, d, b, x = 1, k, ans = 0;
  cin >> n >> k;
  vector<pair<long long, long long>> v(k);
  for (int i = 1; i <= k; i++) {
    for (int mask = 0; mask <= 20; mask++) {
      if (i & (1 << mask)) {
        v.push_back({pow(2, mask), i});
        break;
      }
    }
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  vector<long long> h;
  for (int i = 0; i < v.size(); i++) {
    if (cnt + v[i].first <= n) {
      cnt += v[i].first;
      h.push_back(v[i].second);
    }
    if (cnt == n) {
      break;
    }
  }
  if (h.size() == -1 || cnt != n) {
    cout << -1;
  } else {
    cout << h.size() << endl;
    for (int i = 0; i < h.size(); i++) {
      cout << h[i] << " ";
    }
  }
  return 0;
}
