#P9391. 红草莓
红草莓
Problem Description
There is a necklace made of pearls. The necklace is a ring, with the head and tail connected. One pearl has a special mark, and we call it the starting pearl.
An alien is very good at shooting cosmic rays. It shoots cosmic rays for rounds in order. In round , there is a parameter , which means:
- The alien starts counting from the starting pearl. The starting pearl is numbered , the next pearl is numbered , and so on. After finishing one full circle, it continues counting (for example, pearl is still the starting pearl, and pearl is the next pearl after the starting pearl). The alien will shoot one cosmic ray at every pearl whose number is a multiple of , i.e., pearls numbered .
At the beginning, all pearls are red. Once a pearl is hit by a cosmic ray, it will be dyed from red to blue.
You need to output: for each round of operation, how many pearls that were red before this round are turned blue by this round.
Input Format
The first line: two integers .
The second line: integers .
Output Format
The first line: integers, where the -th integer denotes how many pearls that were red before round are turned blue in that round.
6 6
6 3 4 2 5 1
1 1 2 0 2 0
Hint
Sample Explanation
The figure shows the colors of the pearls initially and after each operation. The starting pearl is numbered . You can see that the numbers of newly dyed blue pearls in each operation are respectively:

Constraints
For all testdata: , .
| Subtask ID | Special Restriction | Score | ||
|---|---|---|---|---|
| None | ||||
| None | ||||

Translated by ChatGPT 5