408428: GYM103117 K K-skip Permutation

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. K-skip Permutationtime limit per test1.0 smemory limit per test256 megabytesinputstandard inputoutputstandard output

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

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

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!

ExamplesInput
3 1
Output
1 2 3 
Input
7 3
Output
2 5 1 4 7 3 6
Input
3 7
Output
1 3 2

加入题单

上一题 下一题 算法标签: