Buttons

No attempts yetTime limit1sMemory limit512 MB

Problem

There is a toy with n+1n+1 buttons. Above each of the first nn buttons there is a small counter, and every counter starts at 00. Pressing a button increases the counter above it by 11.

Button number n+1n+1 behaves in a special way. When it is pressed, all nn counters are set to the largest value that has ever appeared on any counter of the toy so far. For example, if n=5n = 5 and the counters currently show 00, 00, 11, 22, 00, then pressing button n+1n+1 (button 66) makes every counter show 22.

Given the order in which the buttons were pressed, determine the value shown by each counter after all operations are finished.

Input

The first line contains two integers nn and mm (1n,m1061 \le n, m \le 10^6): the number of counters on the toy and the number of operations. The second line contains mm integers p1,p2,,pmp_1, p_2, \dots, p_m (1pin+11 \le p_i \le n+1): the numbers of the buttons that were pressed, in order.

Output

Print nn integers on a single line, separated by single spaces: the values shown by the counters, in order, after all operations are finished.