#include <bits/stdc++.h>
using namespace std;
vector<int> f;
vector<int> ans;
int binary_search(int target) {
  int low = 1, high = f.size() - 1, mid;
  while (low + 1 < high) {
    mid = (low + high) / 2;
    if (f[mid] >= target)
      high = mid - 1;
    else
      low = mid;
  }
  if (f[high] < target) return high;
  return low;
}
int main() {
  int s, k;
  cin >> s >> k;
  f.push_back(0);
  f.push_back(1);
  int sum = 1;
  f.push_back(sum);
  while (sum < s) {
    int tmp = 0;
    if ((int)f.size() - 1 - k > 0) tmp = f[f.size() - 1 - k];
    sum = sum * 2 - tmp;
    f.push_back(sum);
  }
  int num = s;
  while (num > 0) {
    int index = binary_search(num);
    if (f[index + 1] == num) {
      ans.push_back(f[index + 1]);
      num = 0;
    } else {
      ans.push_back(f[index]);
      num -= f[index];
    }
  }
  ans.push_back(0);
  cout << ans.size() << endl;
  cout << ans[0];
  for (int i = 1; i < ans.size(); i++) cout << ' ' << ans[i];
  cout << endl;
  return 0;
}
