#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1000010;
int S, K, N;
long long f[MaxN], s[MaxN];
vector<int> ans;
int main() {
  scanf("%d%d", &S, &K);
  s[1] = f[1] = 1;
  N = 2;
  while ((f[N] = s[N - 1] - s[max(0, N - K - 1)]) <= S) {
    s[N] = s[N - 1] + f[N];
    if (++N > 200) break;
  }
  ans.push_back(0);
  for (int i = N - 1; i > 1; --i)
    if (S >= f[i]) {
      S -= f[i];
      ans.push_back(int(f[i]));
    }
  printf("%d\n", int(ans.size()));
  for (int i = 0; i < int(ans.size()); ++i) printf("%d ", ans[i]);
  return 0;
}
