#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    int sum, limit;
    cin >> sum >> limit;
    vector<pair<int, int>> v;
    for (int i = 1; i <= limit; i++) {
      v.push_back({1 << __builtin_ctz(i), i});
    }
    sort(v.rbegin(), v.rend());
    vector<int> a;
    int i = 0;
    while (sum) {
      if (i == v.size()) break;
      if (sum >= v[i].first) {
        a.push_back(v[i].second);
        sum -= v[i].first;
      }
      i++;
    }
    if (sum != 0)
      cout << "-1\n";
    else {
      cout << a.size() << "\n";
      for (auto i : a) {
        cout << i << " ";
      }
      cout << "\n";
    }
  }
  return 0;
}
