#include <bits/stdc++.h>
using namespace std;
int GCD(int a, int b) {
  if (b == 0) return a;
  return (a % b == 0 ? b : GCD(b, a % b));
}
long long int POW(long long int base, long long int exp) {
  long long int val;
  val = 1;
  while (exp > 0) {
    if (exp % 2 == 1) {
      val = (val * base) % 1000000007;
    }
    base = (base * base) % 1000000007;
    exp = exp / 2;
  }
  return val;
}
vector<int> fib;
vector<int> ans;
int main() {
  int s, k, i, n;
  long long till;
  scanf("%d%d", &s, &k);
  fib.push_back(1);
  till = 1;
  for (i = 1; fib[i - 1] <= s; i++) {
    fib.push_back(till);
    if (i >= k) {
      till = till + fib[i] - fib[i - k];
    } else {
      till = till + fib[i];
    }
  }
  n = fib.size();
  ans.push_back(0);
  for (i = n - 1; i >= 1; i--) {
    if (s >= fib[i]) {
      s = s - fib[i];
      ans.push_back(fib[i]);
    }
  }
  n = ans.size();
  printf("%d\n", n);
  for (i = 0; i < n; i++) {
    printf("%d ", ans[i]);
  }
  printf("\n");
  return 0;
}
