#include <bits/stdc++.h>
using namespace std;
int main() {
  int s, k;
  cin >> s >> k;
  vector<int> a;
  a.push_back(1);
  a.push_back(1);
  int i = 1;
  while (a[i] <= s) {
    int s1 = 0;
    for (int j = i; j > i - k && j >= 0; j--) s1 += a[j];
    a.push_back(s1);
    i++;
  }
  i--;
  vector<int> b;
  while (s > 0) {
    if (s >= a[i]) {
      b.push_back(a[i]);
      s -= a[i--];
    } else
      i--;
  }
  if (b.size() == 1) b.push_back(0);
  cout << b.size() << endl;
  for (int i = 0; i < b.size(); i++) cout << b[i] << ' ';
  return 0;
}
