#include <bits/stdc++.h>
using namespace std;
long long f[100050];
long long n, k;
long long ans[5000];
int tot;
int main() {
  scanf("%I64d%I64d", &n, &k);
  long long temp = 1;
  f[0] = 1;
  int i;
  for (i = 1;; ++i) {
    f[i] = temp;
    temp += f[i];
    if (i - k >= 0) {
      temp -= f[i - k];
    }
    if (f[i] >= n) break;
  }
  tot = 0;
  for (; i >= 0; --i) {
    if (f[i] > n) continue;
    n -= f[i];
    ans[tot++] = f[i];
    if (n == 0) break;
  }
  if (tot == 1) {
    ans[tot++] = 0;
  }
  printf("%d\n", tot);
  for (int i = 0; i < tot; ++i) {
    if (i) printf(" ");
    printf("%I64d", ans[i]);
  }
  puts("");
  return 0;
}
