402195: GYM100694 E SuperHyperMarket
Description
The day of opening of the greatest shop in the world is coming. To show the full potential of their shop, in particular, the unbelievable speed of the cash desks, the owners of the shop came up with the following move: n most average customers will be let into the shop, and the cash desks will be opened only after all customers will choose their purchases and take their places in the queues. The problem is that if the customers walk along the cash desks and choose the optimal queue, the process can last for several hours. That's why you are asked to choose queues for all customers automatically.
The sociologists told you how the average customers choose the queue: they look at the number of people in the queue and at the number of the purchases of the last two people in it. Formally, the customer chooses the cash desk i for which the value xi = ci·p is minimal. Here, ci is the number of people in the i-th queue, and p — is the average (by the average customer's definition) number of purchases of one person in the queue. The value of p is calculated by two last people in the queue: p = (p1 + p2) / 2, if there are two or more people in the queue (p1 and p2 are the numbers of purchases of the last two people), p = p1, if there is only one customer in the queue, and p = 0 if the queue is empty. If there are several cash desks with minimal xi, the customer chooses the one with the minimal number i.
After the customers choose their queue, they don't go anywhere out of it.
InputThe first line contains two space-separated integers n and k (1 ≤ n, k ≤ 105) — the number of customers and the number of cash desks in the shop.
The next line contains n space-separated integers pj (1 ≤ pj ≤ 1000) — the numbers of purchases of the j-th customer in the chronological order. Every customer chooses his queue before the next customer starts doing it.
OutputWrite n space-separated integers in one line. The i-th number should be equal to the number of cash desk where the i-th customer will go using the criterion described in the problem.
ExamplesInput5 2Output
1 3 1 2 3
1 2 1 1 2Input
5 7Output
1 3 1 2 3
1 2 3 4 5