#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
long long f[N], a[N];
int main() {
  int s, k;
  int cnt = 0;
  memset(f, 0, sizeof(f));
  f[0] = 0, f[1] = 1;
  scanf("%d%d", &s, &k);
  int i, j;
  for (i = 2; f[i - 1] < s; ++i) {
    for (j = i - 1; j >= 0 && j >= i - k; --j) {
      f[i] += f[j];
    }
  }
  for (; i > 0 && s > 0; --i) {
    if (f[i] <= s) {
      s -= f[i];
      a[cnt++] = f[i];
    }
  }
  printf("%d\n", cnt);
  for (int i = 0; i < cnt; ++i) printf("%d ", a[i]);
  return 0;
}
