#include <bits/stdc++.h>
using namespace std;
int tmp(int x) {
  int idx = 0;
  while (!(x & 1)) idx++, x >>= 1;
  return idx;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int k, n;
  cin >> k >> n;
  vector<int> v[18];
  for (int i = 1; i <= n; i++) v[tmp(i)].push_back(i);
  vector<int> res;
  for (int i = 17; i >= 0 and k > 0; i--) {
    if (v[i].size() == 0) continue;
    int l = pow(2, i);
    if (k < l)
      continue;
    else {
      int a = k / l;
      int b = min(a, (int)v[i].size());
      for (int j = 0; j < b; j++) res.push_back(v[i][j]);
      k -= b * l;
    }
  }
  if (k > 0)
    cout << -1;
  else {
    cout << res.size() << "\n";
    for (auto a : res) cout << a << " ";
  }
  return 0;
}
