#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int s, k;
  cin >> s >> k;
  deque<int> q;
  vector<int> v;
  q.push_back(1);
  v.push_back(1);
  int sum = 1;
  for (int i = k + 1; i < k + 100 && sum <= s; i++) {
    q.push_back(sum);
    v.push_back(sum);
    sum += sum;
    if ((int)q.size() > k) {
      if (i >= 2 * k) sum -= q.front();
      q.pop_front();
    }
  }
  int i = v.size() - 1;
  vector<int> ans;
  while (s > 0) {
    if (s >= v[i]) {
      s -= v[i];
      ans.push_back(v[i]);
    }
    i--;
  }
  if ((int)ans.size() == 1) {
    cout << ans.size() + 1 << endl;
    cout << 0 << ' ';
  } else {
    cout << ans.size() << endl;
  }
  for (i = 0; i < (int)ans.size(); i++) {
    cout << ans[i] << ' ';
  }
  return 0;
}
