Solution

我们来考虑什么情况下才有解。
首先一个数分解成个数,那么我们可以默认,一共有。我每次如果要拆分,则要将个数拆分成个数,所以增加了个数。
所以,有解的充要条件是,即
接下来,直接按上述方式构造即可。

Code

// Author: wlzhouzhuan
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rint register int
#define rep(i, l, r) for (rint i = l; i <= r; i++)
#define per(i, l, r) for (rint i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)

inline int read() {
  int x = 0, neg = 1; char op = getchar();
  while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
  while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) { putchar('-'); x = -x; }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}

const int N = 1e6 + 5;
int n, x;

int main() {
  //freopen("1.in", "r", stdin);
  //freopen("1.out", "w", stdout);
  cin >> n >> x;
  n--;
  int nn = n;
  queue <int> q;
  for (int i = 1; i <= x; i++) {
    q.push(-1);
    nn--;
  } 
  while (!q.empty() && nn > 0) {
    int u = q.front(); q.pop();
    nn++;
    nn -= x;
    for (int i = 1; i <= x; i++) {
      q.push(u - 1);
    }
  }
  int least = q.back();
  least *= -1;
  print(least), putchar(' ');
  while (!q.empty()) {
    print(q.front() + least), putchar(' ');
    q.pop();
  }
  puts("");
}