#include <bits/stdc++.h>
using namespace std;
void solve();
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
}
const long long INF = (long long)2e9 + 7;
void solve() {
  long long x, d;
  cin >> x >> d;
  vector<long long> res;
  for (long long i = 0; i < 32; ++i) {
    if ((x >> i) & 1) {
      for (long long j = 0; j < i; ++j) res.push_back(INF * (i + 1));
      res.push_back(INF * (i + 1) * 70000ll);
    }
  }
  cout << res.size() << '\n';
  for (auto i : res) cout << i << ' ';
  cout << '\n';
}
