#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
vector<int> s;
bool cmp(const std::pair<int, int> a, const std::pair<int, int> b) {
  return a.first > b.first;
}
int main() {
  int sum, limit, ans = 0;
  cin >> sum >> limit;
  for (int i = 1; i <= limit; i++) v.push_back(make_pair(i & (-i), i));
  sort(v.begin(), v.end(), cmp);
  vector<pair<int, int> >::iterator iter;
  for (iter = v.begin(); iter < v.end(); iter++)
    if (iter->first <= sum) {
      ans++;
      s.push_back(iter->second);
      sum -= iter->first;
    }
  if (sum == 0) {
    cout << ans << endl;
    for (int i = 0; i < s.size(); i++) cout << s[i] << " ";
  } else
    cout << -1;
  return 0;
}
