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