Let and . We need a permutation of with .
Whenever the permutation decreases, it must decrease by exactly one: a larger drop is forbidden, and equal values would repeat a prefix sum.
Suppose its first value is . It must begin . If it increases before reaching , it can never return to the remaining smaller values: moving down to them would require passing through a value already used.
The same argument applies to the unused values. Thus every valid permutation is obtained by splitting into consecutive blocks and reversing each block. For example, blocks , , give .
Inside a block, , which always satisfies its bound. Only the jumps at block starts need to be checked.