A Restaurant for Bears

Each arriving bear takes the smallest empty chair at or above its wanted number that is at least d away from every seated bear.

Medium4ImplementationGreedySortingInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Bears normally do not sit on a chair to eat. Lately, though, some bears eat while seated.

Kangho is a waiter at a huge restaurant for bears. The restaurant has infinitely many chairs, placed in a single row. The chairs are numbered 11, 22, ... starting from the one closest to the entrance.

Bears are very large, so they cannot sit right next to each other. Whenever two bears are seated, the difference between the numbers of their chairs must be at least dd. For example, if d=10d = 10, two bears may sit on chairs 4747 and 5757, but they may not sit on chairs 4747 and 5656.

The restaurant has just opened and every chair is empty.

Today NN bears visit the restaurant, and they arrive one at a time. A bear does not get up from its chair until the restaurant closes.

Each bear that visits has a seat it wants. If the ii-th bear to arrive wants seat AiA_i, the number of the chair it takes must be at least AiA_i.

When Kangho leads a bear to its seat, he picks the smallest-numbered chair that the bear can sit on.

Given the seats the bears want in order of arrival, write a program that finds which chair each bear sits on.

Input

The first line contains the number of bears NN and the distance dd. (1N10001 \le N \le 1000, 1d1061 \le d \le 10^6)

The second line contains the seats the bears want, in order of arrival. A wanted seat is a natural number that is at least 11 and at most 10610^6.

Output

Print the chair each bear sits on, in order of arrival, separated by spaces.

Chair numbers have no upper bound, so an answer can be larger than 10610^6.