#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 5;
int lim, sum;
vector<int> vec;
int lowbit(int x) {
  if (x % 2 != 0)
    return 0;
  else if (!(x & (x - 1)))
    return log2(x);
  else
    return (x & ~(x - 1));
}
void solve() {
  cin >> sum >> lim;
  for (int i = lim; i > 0; i--) {
    int res = i & (-i);
    if (sum - res < 0) continue;
    sum -= res;
    vec.push_back(i);
  }
  if (sum > 0) {
    cout << -1;
    return;
  }
  cout << vec.size() << '\n';
  for (int x : vec) cout << x << " ";
}
int main() {
  solve();
  return 0;
}
