NOI Contest Archive

Archive / 2026 / Qualifier Round

Sensor Calliberation

Medium · NOI 2026 Qualifier Round

Bob is organizing the inventory for an upcoming robotics bootcamp. He has a box containing \(N\) different ultrasonic sensors. Each sensor has a specific operating frequency, denoted by an integer \(A_i\).

To successfully calibrate the main control board, Bob needs to pair up the sensors. A pair of sensors \(i\) and \(j\) (where \(1 \le i < j \le N\)) is considered perfectly calibrated if the sum of their operating frequencies is exactly divisible by a target frequency \(K\).

Given the frequencies of all \(N\) sensors and the target frequency \(K\), help Bob determine the total number of perfectly calibrated pairs he can form.

Input Format

Output Format

Constraints

Sample Input 0

6 5
2 8 3 10 5 7

Sample Output 0

5