#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  a = abs(a);
  b = abs(b);
  if (!b) return a;
  return __gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  a = abs(a);
  b = abs(b);
  return (a / __gcd(a, b)) * b;
}
template <class T>
inline T ncr(T n, T r) {
  return n * (n - 1) / r;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int sum, limit;
  cin >> sum >> limit;
  vector<int> v;
  for (int i = limit; i > 0; i--) {
    int lowbit = (i & -i);
    if (sum >= lowbit) {
      v.push_back(i);
      sum -= lowbit;
    }
  }
  if (sum == 0) {
    cout << v.size() << "\n";
    for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  } else
    cout << -1 << "\n";
  return 0;
}
