#CCBCHBAHAI0000177. Tần suất theo phần dư modulo m (Frequency by Remainder Modulo m)
Tần suất theo phần dư modulo m (Frequency by Remainder Modulo m)
Frequency by Remainder Modulo m
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
You are given non-negative integers and a positive integer .
For every , define
Compute all frequencies .
Input
- The first line contains .
- The second line contains .
Output
Print separated by spaces.
Subtasks
Subtask 1 (20 points): , , .
Subtask 2 (30 points): , , .
Subtask 3 (50 points): , , .
Example
Input
7 4
0 1 2 3 4 8 11
Output
3 1 1 2
Explanation
Modulo 4, remainders 0,1,2,3 occur 3,1,1,2 times respectively.