#include <bits/stdc++.h>
using namespace std;
int k, s;
int F[100010];
int main() {
  cin >> s >> k;
  int sum = 1, m = 0, t = 1;
  F[1] = 1;
  for (int i = 2;; i++) {
    F[i] = sum;
    if (sum > s) break;
    sum += F[i];
    if (i > k) m = F[i - k];
    sum -= m;
    t++;
  }
  vector<int> ans;
  while (s) {
    int cnt = upper_bound(F + 1, F + t + 1, s) - F;
    cnt--;
    s -= F[cnt];
    ans.push_back(F[cnt]);
  }
  printf("%d\n", ans.size() + 1);
  int flag = 1;
  printf("0 ");
  for (int i = 0; i < ans.size(); i++) {
    if (flag)
      flag = 0;
    else
      printf(" ");
    printf("%d", ans[i]);
  }
  puts("");
  return 0;
}
