P27881 [洛谷] [GESP202309 Level 3] Xiao Yang's Savings
普及-
题目描述

Problem Description

Xiao Yang has a total of $N$ piggy banks, numbered from $0$ to $N-1$. Starting from the first day, Xiao Yang deposits money into the piggy banks every day. Specifically, on the $i$-th day, he selects a piggy bank $a_i$ and deposits $i$ yuan into it. After $D$ days, he has forgotten how much money is in each piggy bank. Can you help him figure it out?

Input Format

The input consists of 2 lines. The first line contains two integers $N$ and $D$; the second line contains $D$ integers, where the $i$-th integer is $a_i$ (guaranteed $0 \le a_i \le N-1$).

Each integer in a line is separated by a single space.

It is guaranteed that $1 \le N \le 1,000$; $1 \le D \le 1,000$.

Output Format

Output $N$ integers separated by single spaces, where the $i$-th integer represents the amount of money in the piggy bank numbered $i-1$ ($i=1, \cdots, N$).

Sample Input and Output

Sample Input #1

2 3
0 1 0

Sample Output #1

4 2

Sample Input #2

3 5
0 0 0 2 0

Sample Output #2

11 0 4

Notes

Sample Explanation 1:

On the 1st, 2nd, and 3rd days, Xiao Yang deposited 1 yuan, 2 yuan, and 3 yuan into piggy banks 0, 1, and 0 respectively. Therefore, piggy bank 0 has $1+3=4$ yuan, and piggy bank 1 has 2 yuan.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 3 0 1 0
样例输出
4 2