#include <bits/stdc++.h>
using namespace std;
int main() {
  int sum, limit, cont = 0;
  vector<pair<int, int> > v(100000);
  std::vector<int> aux;
  scanf("%d %d", &sum, &limit);
  for (int i = 1; i <= 100000; ++i)
    v[i - 1] = make_pair(pow(2, __builtin_ctz(i)), i);
  sort(v.begin(), v.end());
  for (int i = 99999; i >= 0; i--) {
    if (v[i].first <= sum - cont and v[i].second <= limit) {
      cont += v[i].first;
      aux.push_back(v[i].second);
      if (cont == sum) {
        printf("%d\n", aux.size());
        for (int j = 0; j < aux.size(); ++j) {
          if (j + 1 != aux.size())
            printf("%d ", aux[j]);
          else
            printf("%d\n", aux[j]);
        }
        break;
      }
    }
  }
  if (cont != sum) printf("-1\n");
}
