#include <bits/stdc++.h>
using namespace std;
int kbon[1000];
vector<int> v;
int main() {
  int s, k;
  scanf(" %d %d", &s, &k);
  kbon[0] = 1;
  kbon[1] = 1;
  int x = 2;
  while (kbon[x - 1] < s) {
    if (x - 1 - k >= 0)
      kbon[x] = kbon[x - 1] * 2 - kbon[x - 1 - k];
    else
      kbon[x] = kbon[x - 1] * 2;
    x++;
  }
  x--;
  while (s > 0) {
    if (kbon[x] <= s) {
      s -= kbon[x];
      v.push_back(kbon[x]);
    }
    x--;
  }
  printf("%d\n", v.size() + 1);
  printf("0");
  for (int i = v.size() - 1; i >= 0; i--) printf(" %d", v[i]);
  return 0;
}
