#include <bits/stdc++.h>
using namespace std;
int kbo[1001];
int main() {
  int s, k, i;
  scanf("%d%d", &s, &k);
  kbo[0] = 0;
  kbo[1] = 1;
  kbo[2] = 1;
  for (i = 3;; i++) {
    if (i - k - 1 > 0)
      kbo[i] = 2 * kbo[i - 1] - kbo[i - k - 1];
    else
      kbo[i] = 2 * kbo[i - 1];
    if (kbo[i] > s) break;
  }
  for (int j = 0; j < i; ++j) {
  }
  int res[100], cnt = 0;
  while (s > 0) {
    i--;
    if (s - kbo[i] >= 0) {
      s -= kbo[i];
      res[cnt++] = kbo[i];
    }
  }
  if (cnt == 1)
    printf("2\n0 %d", res[0]);
  else {
    printf("%d\n", cnt);
    for (int j = 0; j < cnt; j++) printf("%d ", res[j]);
  }
  return 0;
}
