|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||256 MB||0||0||0||0.000%|
There are $T$ processes running in the multitasking operating system <<Squirrel OS>>. Each of the $T$ processes has a given priority $p_i$, which affects how often the process is run. Since the system only has a single core in a single processor to run things, it is facing a challenge of distributing the CPU time between these processes, taking their priorites into account.
The algorithm of defining which process is run at each time moment can be described in the following way. For each process, in addition to the priority $p_i$, there is also a counter $t_i$. Initially all $t_i$ equal 0. Then every second:
Model the work of the operating system for $T$ seconds and calculate for how many seconds each process was run. Assume that all calculations and switches between processes are instant, so the running time for each process in seconds is an integer.
The first line contains two space-separated integers $N$ and $T$ --- the number of processes in the operating system ($1 \le N \le 10^5$) and the number of seconds to be modeled ($1 \le T \le 10^6$).
The second line contains $N$ space-separated integers $p_i$ --- the process priorities ($0 \le p_i \le 10^5$).
In the only line of the output file, print $N$ space-separated integers --- for how many seconds each of the processes was run.
3 10 3 4 5
3 3 4