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.
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 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!
3 1
1 2 3
7 3
2 5 1 4 7 3 6
3 7
1 3 2
Name |
---|