#include <bits/stdc++.h>
using namespace std;
int s, k, cnt, f[200], ans[200];
int main() {
  scanf("%d%d", &s, &k);
  f[1] = 1;
  int cnt = 1;
  for (int i = 2; i <= 200; i++) {
    int idx = i;
    cnt++;
    for (int j = 1; j <= k; j++) {
      idx--;
      if (idx == 0) break;
      f[i] += f[idx];
    }
    if (f[i] > s) break;
  }
  int res = s, num = 0;
  for (int i = cnt - 1; i >= 1; i--) {
    if (res >= f[i]) {
      num++;
      ans[num] = f[i];
      res -= f[i];
    }
    if (res == 0) break;
  }
  if (num == 1) {
    num++;
    ans[num] = 0;
  }
  printf("%d\n", num);
  for (int i = 1; i < num; i++) printf("%d ", ans[i]);
  printf("%d\n", ans[num]);
  return 0;
}
