#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
const long long int INF = 2e18 + 10;
const int Mod = 1e9 + 7;
const int MAXN = 100010;
const int N = 2e3 + 10;
const int M = 1e3 + 10;
const int M1 = 1e9 + 7;
const int M2 = 1e9 + 9;
const int base = 131;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int sum, lim;
  cin >> sum >> lim;
  vector<pair<int, int> > v;
  for (int i = 1; i <= lim; i++) {
    v.push_back({i & (-1 * i), i});
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  vector<int> ans;
  for (int i = 0; i < v.size(); i++) {
    int ele = v[i].first;
    if (ele <= sum) sum -= ele, ans.push_back(v[i].second);
  }
  if (sum != 0)
    cout << "-1" << endl;
  else {
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
    cout << endl;
  }
  return 0;
}
