AT_abc410_b [ABC410B] Reverse Proxy

Description

There are $ N $ boxes numbered $ 1,2,\dots,N $ . Initially, all boxes are empty. $ Q $ balls will come in order. Takahashi will put the balls into the boxes according to the sequence $ X=(X_1,X_2,\dots,X_Q) $ . Specifically, he performs the following process for the $ i $ -th ball: - If $ X_i \ge 1 $ : Put this ball into box $ X_i $ . - If $ X_i = 0 $ : Put this ball into the box with the smallest number among those containing the fewest balls. Find which box each ball was put into.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ Q $ $ X_1 $ $ X_2 $ $ \dots $ $ X_Q $

Output Format

If the $ i $ -th ball was put into box $ B_i $ , output in the following format: > $ B_1 $ $ B_2 $ $ \dots $ $ B_Q $

Explanation/Hint

### Sample Explanation 1 There are $ 4 $ boxes, and $ 5 $ balls come. - Initially, all boxes are empty. - The numbers of balls in box $ 1,2,3,4 $ are $ 0,0,0,0 $ , respectively. - Since $ X_1=2 $ , put the $ 1 $ st ball into box $ 2 $ . - The numbers of balls in box $ 1,2,3,4 $ are $ 0,1,0,0 $ , respectively. - Since $ X_2=0 $ , put the $ 2 $ nd ball into box $ 1 $ , which has the smallest number among those containing the fewest balls. - The numbers of balls in box $ 1,2,3,4 $ are $ 1,1,0,0 $ , respectively. - Since $ X_3=3 $ , put the $ 3 $ rd ball into box $ 3 $ . - The numbers of balls in box $ 1,2,3,4 $ are $ 1,1,1,0 $ , respectively. - Since $ X_4=0 $ , put the $ 4 $ th ball into box $ 4 $ , which has the smallest number among those containing the fewest balls. - The numbers of balls in box $ 1,2,3,4 $ are $ 1,1,1,1 $ , respectively. - Since $ X_5=0 $ , put the $ 5 $ th ball into box $ 1 $ , which has the smallest number among those containing the fewest balls. - The numbers of balls in box $ 1,2,3,4 $ are $ 2,1,1,1 $ , respectively. The balls were put into boxes $ 2,1,3,4,1 $ in order. Thus, output `2 1 3 4 1`. ### Constraints - All input values are integers. - $ 1 \le N \le 100 $ - $ 1 \le Q \le 100 $ - $ 0 \le X_i \le N $