#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:300000000")
#pragma warning(disable : 4800)
using namespace std;
void showTime() { cerr << (double)clock() / CLOCKS_PER_SEC << endl; }
const double pi = 3.1415926535897932384626433832795;
template <class T>
T abs(const T &a) {
  return a >= 0 ? a : -a;
};
template <class T>
T sqr(const T &x) {
  return x * x;
}
int s, k;
int main() {
  cin >> s >> k;
  vector<long long> v;
  v.push_back(1);
  while (true) {
    long long x = 0;
    for (int i = max(0, int((v).size()) - k); i < int((v).size()); i++)
      x += v[i];
    if (x > s) break;
    v.push_back(x);
  }
  long long sum = 0;
  vector<long long> ans;
  for (int i = int((v).size()) - 1; i >= 0; i--) {
    if (sum + v[i] <= s) {
      sum += v[i];
      ans.push_back(v[i]);
    }
    if (sum == s) break;
  }
  if (int((ans).size()) == 1) ans.push_back(0);
  cout << int((ans).size()) << endl;
  for (int i = 0; i < (int((ans).size())); i++) cout << ans[i] << ' ';
}
