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