#include <bits/stdc++.h>
using namespace std;
vector<long long> ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int i, j, k, m, n, T;
  long long X, d;
  cin >> X >> d;
  long long now = 1;
  vector<int> tt;
  while (X) {
    int cnt = 1;
    long long now = 2;
    while (now - 1 <= X) {
      cnt++;
      now <<= 1;
    }
    now >>= 1;
    cnt--;
    X -= now - 1;
    tt.push_back(cnt);
  }
  for (auto it : tt) {
    for (int j = 1; j <= it; ++j) ans.emplace_back(now);
    now += d + 5;
  }
  cout << ans.size() << endl;
  for (auto it : ans) cout << it << " ";
  return 0;
}
