#include <bits/stdc++.h>
using namespace std;
long long a[1000];
int main() {
  long long k, s;
  cin >> s >> k;
  memset(a, 0, sizeof(a));
  a[0] = 1;
  int i;
  for (i = 1;; i++) {
    int j;
    if (i > k)
      j = i - k;
    else
      j = 0;
    for (; j < i; j++) {
      a[i] += a[j];
    }
    if (a[i] > s) break;
  }
  vector<int> v;
  for (int j = i; s != 0 && j >= 0; j--) {
    if (a[j] <= s) {
      s -= a[j];
      v.push_back(a[j]);
    }
  }
  if (v.size() == 1) v.push_back(0);
  cout << v.size() << endl;
  for (int j = v.size() - 1; j >= 0; j--) cout << v[j] << " ";
}
