#include <bits/stdc++.h>
using namespace std;
map<long long, long long> arr;
int pre[60] = {1};
vector<int> vec;
int main() {
  int s, k;
  scanf("%d %d", &s, &k);
  long long sum = 1;
  arr[k] = 1;
  int idx = k + 1;
  for (; 1; idx++) {
    sum -= arr[idx - k - 1];
    arr[idx] = sum;
    sum += arr[idx];
    if (sum > 1e9 + 7) break;
  }
  vec.push_back(0);
  for (int i = idx; i; i--) {
    if (s >= arr[i]) {
      vec.push_back(arr[i]);
      s -= arr[i];
    }
    if (s == 0) break;
  }
  printf("%d\n", vec.size());
  for (int i = 0; i < vec.size(); i++) printf("%d ", vec[i]);
}
