#include <bits/stdc++.h>
using namespace std;
const int N = 100, M = 1e5 + 5, OO = 0x3f3f3f3f;
long long A[3], c = 0;
vector<pair<long long, long long> > v;
vector<int> v2;
int main() {
  long long n, m = 0, ch = 0;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int j = 0;
    while (!((i >> j) & 1)) {
      j++;
    }
    v.push_back({pow(2, j), i});
  }
  sort(v.rbegin(), v.rend());
  for (int i = 0; i < v.size(); i++) {
    if (n >= v[i].first) n -= v[i].first, v2.push_back(v[i].second);
    if (!n) break;
  }
  if (!n) {
    cout << v2.size() << endl;
    for (int i : v2) cout << i << " ";
  } else
    cout << -1;
  return 0;
}
