#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
using vc = vector<T>;
ll s, k, A[(ll)1e5 + 10], t, tp;
int main() {
  scanf("%lld %lld", &s, &k);
  tp = k - 1;
  while (t < s) {
    t = (tp == k - 1 || tp == k)
            ? 1
            : (t + A[tp - k] - (tp - 2 * k >= 0 ? A[tp - 2 * k] : 0));
    A[(tp++) - k + 1] = t;
  }
  set<ll> S{0};
  for (ll i = tp - k + 1; i >= 0; i--) {
    if (s >= A[i]) {
      s -= A[i];
      S.insert(A[i]);
    }
    if (0 == s) {
      break;
    }
  }
  printf("%lld\n", (ll)S.size());
  for (auto &i : S) {
    printf("%lld ", i);
  }
  printf("\n");
  return 0;
}
