#CCBCHBAHAI0000058. Divisible Sum Pairs (Divisible Sum Pairs)
Divisible Sum Pairs (Divisible Sum Pairs)
Divisible Sum Pairs (Divisible Sum Pairs)
Source: HackerRank
Version: Phuoc Hung OJ Extended
Problem
Given and a positive integer , count index pairs such that
and
Each index pair is counted once.
Input
The first line contains and . The second line contains integers .
Output
Print the number of valid pairs.
Subtask
Subtask 1 (20 points): , .
Subtask 2 (30 points): , .
Subtask 3 (50 points): , , .
Example
Input
6 3
1 3 2 6 1 2
Output
5
Explanation
The sample follows the definitions and rules above.