#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:500000000")
using namespace std;
vector<long long> A, res;
long long s;
int k, size = 1;
int main() {
  scanf("%I64d %d", &s, &k);
  A.push_back(0);
  A.push_back(1);
  while (1) {
    int h = min(k, (int)A.size());
    int it = (int)A.size() - 1;
    long long sum = 0;
    while (h--) {
      sum += A[it--];
      if (sum > 1e9) goto Sol;
    }
    A.push_back(sum);
  }
Sol:
  A.resize(unique(A.begin(), A.end()) - A.begin());
  for (int i = (int)A.size() - 1; i >= 0; i--)
    if (A[i] <= s) {
      res.push_back(A[i]);
      s -= A[i];
    }
  printf("%d\n", res.size());
  printf("%I64d", res[0]);
  for (int i = 1; i < res.size(); i++) printf(" %I64d", res[i]);
  puts("");
  return 0;
}
