#include <bits/stdc++.h>
using namespace std;
vector<int> a, b;
long long t = 1;
int s, k, i;
int main() {
  scanf("%d %d", &s, &k);
  a.push_back(0), a.push_back(1);
  for (int n = 3; t <= s; n++) {
    a.push_back(t);
    t = 0;
    for (i = max(n - k, 0); i < n; i++) t += a[i];
  }
  a.erase(a.begin() + 1);
  for (i = a.size() - 1; i >= 0; i--)
    if (a[i] <= s) {
      b.push_back(a[i]);
      s -= a[i];
    }
  printf("%d\n", b.size());
  for (i = b.size() - 1; i > 0; i--) printf("%d ", b[i]);
  printf("%d\n", b[i]);
  return 0;
}
