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