#include <bits/stdc++.h>
using namespace std;
int main() {
  int s, k;
  scanf("%d %d", &s, &k);
  vector<long long> fk;
  fk.insert(fk.begin(), 1);
  while (fk[0] <= s) {
    long long val = 0;
    for (int i = 0; i < k && i < fk.size(); ++i) val += fk[i];
    fk.insert(fk.begin(), val);
  }
  vector<int> v;
  int i = 1;
  int res = fk[i];
  v.push_back(fk[i]);
  i++;
  while (res != s) {
    if (res + fk[i] <= s) {
      res += fk[i];
      v.push_back(fk[i]);
    }
    i++;
  }
  if (v.size() == 1) v.insert(v.begin(), 0);
  printf("%d\n", v.size());
  for (int i = 0; i < v.size(); ++i) {
    printf("%d%s", v[i], i < v.size() - 1 ? " " : "\n");
  }
  return 0;
}
