#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 5;
const long long int INF = 1e18;
const long long int MOD = 1e9 + 7;
int main() {
  long long int x, d, in = 0, val = 1, num = 0, rem, maxx = 0;
  cin >> x >> d;
  vector<long long int> v;
  while (true) {
    long long int cnt = 0;
    num++;
    while (pow(2, cnt + 1) - 1 + in < x) {
      cnt++;
      maxx = max(maxx, val);
      v.push_back(val);
    }
    in += pow(2, cnt) - 1;
    if (in > x || cnt == 0) {
      rem = x - in;
      break;
    }
    val += d;
  }
  for (long long int i = 1; i <= rem; i++)
    maxx = max(maxx, val), v.push_back(val), val += (d);
  if (v.size() > 10000 || maxx >= 1e18)
    cout << -1 << endl;
  else {
    cout << v.size() << endl;
    for (long long int i = 0; i < v.size(); i++) cout << v[i] << " ";
    cout << endl;
  }
}
