#agc003e. [agc003_e]Sequential operations on Sequence

[agc003_e]Sequential operations on Sequence

Problem Statement

Snuke got an integer sequence from his mother, as a birthday present. The sequence has NN elements, and the ii-th of them is ii. Snuke performs the following QQ operations on this sequence. The ii-th operation, described by a parameter qiq_i, is as follows:

  • Take the first qiq_i elements from the sequence obtained by concatenating infinitely many copy of the current sequence, then replace the current sequence with those qiq_i elements.

After these QQ operations, find how many times each of the integers 11 through NN appears in the final sequence.

Constraints

  • 1N1051 ≦ N ≦ 10^5
  • 0Q1050 ≦ Q ≦ 10^5
  • 1qi10181 ≦ q_i ≦ 10^{18}
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN QQ q1q_1 : qQq_Q

Output

Print NN lines. The ii-th line (1iN)(1 ≦ i ≦ N) should contain the number of times integer ii appears in the final sequence after the QQ operations.


Sample Input 1

5 3
6
4
11

Sample Output 1

3
3
3
2
0

After the first operation, the sequence becomes: 1,2,3,4,5,11,2,3,4,5,1.

After the second operation, the sequence becomes: 1,2,3,41,2,3,4.

After the third operation, the sequence becomes: 1,2,3,4,1,2,3,4,1,2,31,2,3,4,1,2,3,4,1,2,3.

In this sequence, integers 1,2,3,4,51,2,3,4,5 appear 3,3,3,2,03,3,3,2,0 times, respectively.


Sample Input 2

10 10
9
13
18
8
10
10
9
19
22
27

Sample Output 2

7
4
4
3
3
2
2
2
0
0