P14127 [SCCPC 2021] K-skip Permutation
Description
For a permutation $P = p_1, p_2, \cdots, p_n$ of $n$, let $f(P, k)$ be the number of $i$ satisfying $1 \le i < n$ and $p_i + k = p_{i+1}$.
Given two integers $n$ and $k$, your task is to find a permutation $P$ of $n$ such that $f(P, k)$ is maximized.
Recall that in a permutation of $n$, each integer from $1$ to $n$ (both inclusive) appears exactly once.
Input Format
There is only one test case in each test file.
The first and only line contains two integers $n$ and $k$ ($1 \le n, k \le 10^6$).
Output Format
Output one line containing $n$ integers indicating a permutation $P$ of $n$ that maximizes $f(P, k)$. If there are multiple valid answers you can output any of them.
Please, DO NOT output extra spaces at the end of the line, or your answer may be considered incorrect!