#include <bits/stdc++.h>
using namespace std;
vector<long long> ans;
vector<long long> wow;
int main() {
  long long x, d;
  cin >> x >> d;
  while (x > 0) {
    long long track = 0;
    long long br = 0;
    for (long long i = 1; i <= 40; i++) {
      if (((1ll << i) - 1) <= x) {
        track = i;
        br = (1ll << i) - 1;
      }
    }
    ans.push_back(track);
    x -= br;
  }
  long long add = 1;
  long long ad2 = 1e11;
  for (int i = 0; i < ans.size(); i++) {
    long long pr = ans[i];
    while (pr--) {
      wow.push_back(add);
    }
    add += ad2;
  }
  cout << wow.size() << endl;
  for (int i = 0; i < wow.size(); i++) {
    cout << wow[i] << " ";
  }
}
