#CCBCHBAHAI0000177. Tần suất theo phần dư modulo m (Frequency by Remainder Modulo m)

    ID: 1095 Loại: Thông thường 2000ms 256MiB Tried: 0 Đã chấp nhận: 0 Độ khó: 1 Đăng bởi: Nhãn>Programming language basicsStatic arraysIteration techniquesImplementation techniquesInteger arithmetic

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 nn non-negative integers a1,a2,…,ana_1,a_2,\ldots,a_n and a positive integer mm.

For every r∈{0,1,…,m−1}r\in\{0,1,\ldots,m-1\}, define

cr=∣{i∣ai mod m=r}∣.c_r=\left|\{i\mid a_i\bmod m=r\}\right|.

Compute all frequencies c0,c1,…,cm−1c_0,c_1,\ldots,c_{m-1}.

Input

  • The first line contains n,mn,m.
  • The second line contains a1,a2,…,ana_1,a_2,\ldots,a_n.

Output

Print c0,c1,…,cm−1c_0,c_1,\ldots,c_{m-1} separated by spaces.

Subtasks

Subtask 1 (20 points): 1≤n≤501\le n\le 50, 1≤m≤101\le m\le 10, 0≤ai≤10000\le a_i\le 1000.

Subtask 2 (30 points): 1≤n≤50001\le n\le 5000, 1≤m≤1001\le m\le 100, 0≤ai≤10000000\le a_i\le 1000000.

Subtask 3 (50 points): 1≤n≤1000001\le n\le 100000, 1≤m≤10001\le m\le 1000, 0≤ai≤10000000000\le a_i\le 1000000000.

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.