#include <bits/stdc++.h>
using namespace std;
int lowbit(int x) {
  if (x % 2 != 0)
    return 1;
  else {
    int c = 0;
    while (x % 2 == 0) {
      x /= 2;
      c++;
    }
    return pow(2, c);
  }
}
bool sortcol(const pair<int, int> &v1, const pair<int, int> &v2) {
  return v1.second < v2.second;
}
int main() {
  int sum, limit, check = 0, s = 0;
  vector<pair<int, int>> v;
  vector<int> result;
  cin >> sum >> limit;
  for (int i = 1; i <= limit; i++) {
    v.push_back(make_pair(i, lowbit(i)));
  }
  sort(v.begin(), v.end(), sortcol);
  for (int i = v.size() - 1; i >= 0; i--) {
    if (v[i].second + s <= sum) {
      s += v[i].second;
      result.push_back(v[i].first);
    }
  }
  if (s == sum) {
    cout << result.size() << endl;
    for (int i = 0; i < result.size(); i++) cout << result[i] << "  ";
  } else {
    cout << "-1";
  }
  return 0;
}
