#include <bits/stdc++.h>
using namespace std;
int f[1000000];
void answer(int s, int i, int ans) {
  if (i < 0) {
    cout << ans << "\n";
    return;
  }
  while (f[i] > s) i--;
  answer(s - f[i], i - 1, ans + 1);
  cout << f[i] << " ";
}
int main() {
  int s, k;
  cin >> s >> k;
  f[0] = 0;
  f[1] = 1;
  f[2] = 1;
  for (int i = 2; i < k; i++) {
    if (f[i] >= s) {
      answer(s, i, 0);
      return 0;
    }
    f[i + 1] = f[i] * 2;
  }
  int i = k;
  while (true) {
    if (f[i] >= s) {
      answer(s, i, 0);
      return 0;
    }
    f[i + 1] = f[i] * 2 - f[i - k];
    i++;
  }
  return 0;
}
