#include <bits/stdc++.h>
using namespace std;
pair<int, int> s[100010];
int ans[100010], ret;
int main() {
  int sum, n;
  scanf("%d%d", &sum, &n);
  for (int i = 1; i <= n; i++) s[i] = pair<int, int>((i & (-i)), i);
  sort(s + 1, s + n + 1);
  for (int i = n; i >= 1; i--)
    if (sum >= s[i].first) sum -= s[i].first, ans[++ret] = s[i].second;
  if (sum) return 0 * printf("-1\n");
  printf("%d\n", ret);
  for (int i = 1; i <= ret; i++) printf("%d%c", ans[i], i == ret ? '\n' : ' ');
  return 0;
}
