#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int s, k, i, j;
  cin >> s >> k;
  int f[1000] = {0}, a[1000] = {0};
  f[0] = 0;
  f[1] = 1;
  for (i = 2; f[i - 1] <= s; i++) {
    for (j = i - 1; j >= 0 && j >= i - k; j--) {
      f[i] += f[j];
    }
  }
  int t = 0;
  for (; i > 0 && s > 0; i--) {
    if (f[i] <= s) {
      a[t++] = f[i];
      s -= f[i];
    }
  }
  cout << t << "\n";
  for (i = 0; i < t; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
