#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int sum, limit, start = 0, end = 0;
  cin >> sum >> limit;
  vector<pair<long long int, long long int>> v;
  vector<long long int> ans;
  for (long long int i = 1; i <= limit; i++) {
    long long int t = i, cn = 0;
    while (t > 0) {
      if (t % 2 == 0)
        t /= 2, cn++;
      else
        break;
    }
    long long int val = pow(2, cn);
    v.push_back(make_pair(val, i));
  }
  sort(v.begin(), v.end());
  for (long long int i = v.size() - 1; i >= 0; i--) {
    if (sum < v[i].first)
      continue;
    else
      sum -= v[i].first, ans.push_back(v[i].second);
    if (sum == 0) break;
  }
  if (sum) {
    cout << "-1";
    return 0;
  }
  cout << ans.size() << endl;
  for (long long int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
