#include <bits/stdc++.h>
using namespace std;
long long n, i, j, t = 1, s = 1, k, e, l = 1, l2, l3, a, dp[500001], b, mx = 1,
                   A[500001], m, c, p = 1;
vector<long long> verr;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  dp[1] = 1;
  l = 1;
  s = 1;
  while (dp[l] < n) {
    l++;
    if (l - p > k) {
      s = s - dp[p];
      p++;
    }
    dp[l] = s;
    s = s + dp[l];
  }
  while (n > 0) {
    while (dp[l] > n) l--;
    n = n - dp[l];
    verr.push_back(dp[l]);
  }
  if (verr.size() == 1) verr.push_back(0);
  cout << verr.size() << '\n';
  for (i = 0; i < verr.size(); i++) cout << verr[i] << " ";
}
