Little Ivan likes to play Yamb and read Marvel superhero comics. His favorite superhero is spider-man, a friendly neighbourhood teenager named Peter Parker who got his superpowers via a radioactive spider bite. Ivan fantasizes that one day he will be able to jump from one skyscraper to another, just like spider-man does in the comics. During one such fantasy, he fell asleep.
In his dream he was no longer named Ivan, his name was Peter Parkour and, you guessed it, he was able to use his parkour skills to jump between skyscrapers. He quickly realized that there are exactly skyscrapers in his surroundings and he somehow knew that -th of those skyscrapers is meters tall. He knows that he is able to jump from the -th skyscraper to the -th skyscraper if the remainder when dividing with is equal to . Help Ivan determine, for every skyscraper, the number of other skyscrapers he can jump to.
The first line contains two integers and from the task description.
The next line contains integers from the task description.
In a single line you should output space-separated integers such that the -th of those integers represents the number of different skyscrapers on which Peter Parkour can jump on if he jumps from the -th skyscraper.
In test cases worth a total of points, it will hold
In test cases worth an additional points, there will be at most skyscrapers of different heights.
In test cases worth an additional points, it will hold .
Sample Input 1
2 1 5 5
Sample Output 1
Sample Input 2
6 3 4 3 12 6 8 2
Sample Output 2
0 4 0 0 0 0
Sample Input 3
5 1 1 3 5 7 2
Sample Output 3
4 1 1 2 0
Explanation for Sample Output 3
From the first skyscraper of height Peter can jump on any other skyscraper.
From the second skyscraper of height Peter can jump only on a skyscraper of height .
From the third skyscraper of height Peter can jump only on a skyscraper of height .
From the fourth skyscraper of height Peter can jump on skyscrapers of heights and .
From the fifth skyscraper of height Peter cannot jump on any other skyscraper.