#include <bits/stdc++.h>
using namespace std;
int a[100005 + 1][21], b[100005 + 1];
int main() {
  ios::sync_with_stdio(false);
  for (int i = 1; i <= 100005; i++) {
    int k = 0, j = i;
    while (j % 2 == 0) {
      k++;
      j /= 2;
    }
    for (int j = 0; j < 21; j++) a[i][j] = a[i - 1][j];
    a[i][k]++;
    b[i] = k;
  }
  int sum, limit;
  while (cin >> sum >> limit) {
    vector<int> ans;
    int cnt[21];
    memset(cnt, 0, sizeof(cnt));
    for (int i = 20; i >= 0 && sum; i--) {
      int x = pow(2.0, i);
      int y = min(sum / x, a[limit][i]);
      sum = sum - (x * y);
      cnt[i] = y;
    }
    if (sum)
      cout << -1 << endl;
    else {
      for (int i = 1; i <= limit; i++) {
        if (cnt[b[i]]) {
          ans.push_back(i);
          cnt[b[i]]--;
        }
      }
      cout << ans.size() << endl;
      cout << ans[0];
      for (int i = 1; i < ans.size(); i++) cout << " " << ans[i];
      cout << endl;
    }
  }
  return 0;
}
