#include <bits/stdc++.h>
using namespace std;
int p[10];
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> vec;
  vec.push_back(0);
  vec.push_back(1);
  for (int i = 2;; i++) {
    long long sum = 0;
    for (int j = i - 1, k = 0; j >= 0 && k < m; j--, k++) sum += vec[j];
    vec.push_back(sum);
    if (sum > n) break;
  }
  vector<long long> ans;
  for (int i = vec.size() - 1; i >= 0; i--) {
    if (n >= vec[i]) {
      n -= vec[i];
      ans.push_back(vec[i]);
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
}
