This page is still under construction.

Parts of this page are still being built. What you see may change.

A Strange Exhibit

Time limit2sMemory limit512 MB

Summary
Given the inversion counts of every window of length k in an unknown permutation of 1..n, reconstruct any valid permutation.
Level

Hard8 of 10

Topics
Implementation, Greedy, Brute force, Combinatorics
Solved
No attempts yet

Problem

A new exhibit recently arrived at the exhibition of strange devices. It generates a random permutation of the numbers from 11 to nn, scans it, and prints n−k+1n - k + 1 numbers on its screen. The ii-th of these numbers is the number of inversions in the segment of the generated permutation from position ii to position i+k−1i + k - 1.

Recall that an inversion in a permutation pp is any pair of indices i,ji, j such that 1≤i<j≤n1 \le i < j \le n and p\[i] > p\[j]\].

Besides the screen, the exhibit has two knobs. The first sets nn, the length of the permutation, and the second sets kk. A visitor named Vasya turned the knobs and saw numbers on the screen. Now he wants to figure out which permutation the strange device generated. Help him.

Input

The first line contains two positive integers nn and kk (2≤n≤1052 \le n \le 10^5, 2≤k≤52 \le k \le 5, n≥kn \ge k). The second line contains the n−k+1n - k + 1 numbers printed by the device. The device is guaranteed to work correctly, and at least one permutation can produce these numbers.

Output

Print nn numbers separated by spaces: the permutation generated by the device. If several permutations are possible, print any one of them.

Examples1

  1. Example 1

    Input
    3 2
    0 1
    
    Expected output
    1 3 2