#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
int a[100], n, k, num, ans[100];
int find(int x) {
  int l = 1, r = num, mid = 0;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (a[mid] > n)
      r = mid - 1;
    else
      l = mid + 1;
  }
  return r;
}
int main() {
  scanf("%d%d", &n, &k);
  a[1] = 1;
  for (int i = 2;; i++) {
    for (int j = 1; j <= min(i - 1, k); j++) a[i] += a[i - j];
    if (a[i] >= n) {
      num = i;
      break;
    }
  }
  int cnt = 0;
  while (n) {
    ans[++cnt] = find(n);
    n -= a[ans[cnt]];
  }
  if (cnt == 1) ans[++cnt] = 0;
  printf("%d\n", cnt);
  for (int i = 1; i < cnt; i++) printf("%d ", a[ans[i]]);
  printf("%d\n", a[ans[cnt]]);
}
