#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  long long sum, limit, val, n, i, j, x = 0, ans = 0, flag = 0;
  cin >> sum >> limit;
  vector<long long> st;
  for (i = limit; i >= 1; i--) {
    x = 0;
    ans = 0;
    n = i;
    while (ans == 0) {
      ans = 1 & (n);
      n = n >> 1;
      x++;
    }
    val = pow(2, x - 1);
    if (sum - val == 0) {
      st.push_back(i);
      flag = 1;
      break;
    } else if (sum - val > 0) {
      st.push_back(i);
      sum -= val;
    }
  }
  if (flag == 0) {
    cout << -1 << endl;
  } else {
    cout << st.size() << endl;
    for (int i = 0; i < st.size(); i++) {
      cout << st[i] << " ";
    }
  }
}
