#include <bits/stdc++.h>
using namespace std;
int f[55], s, k, Max;
int check[55];
int w = 0;
vector<int> vec;
void dfs(int sum) {
  if (sum > s) return;
  if (sum == s) {
    if (vec.size() <= 1) vec.push_back(0);
    printf("%d\n", vec.size());
    for (int i = 0; i < vec.size(); i++) printf("%d ", vec[i]);
    printf("\n");
    w = 1;
    return;
  }
  for (int i = Max; i >= 0; i--) {
    if (!check[i]) {
      vec.push_back(f[i]);
      check[i] = 1;
      dfs(sum + f[i]);
      if (w) return;
      check[i] = 0;
      vec.pop_back();
    }
  }
}
int main() {
  scanf("%d%d", &s, &k);
  f[0] = 0;
  f[1] = 1;
  Max = 987654321;
  for (int i = 2;; i++) {
    for (int j = 1; j <= k && i - j >= 0; j++) f[i] += f[i - j];
    if (f[i] > s) {
      Max = i - 1;
      break;
    } else if (f[i] == s) {
      Max = i;
      break;
    }
    if (Max != 987654321) break;
  }
  if (Max >= 2) {
    unique(f, f + Max + 1);
    Max--;
  }
  dfs(0);
}
