def divisibleSumPairs(n, k, ar):
    # Write your code here
    
    # i < j
    cnt = 0
    for head in range(len(ar)):
        tail = head + 1
        while tail < n:
            if (ar[head] + ar[tail]) % k == 0:
                cnt += 1
                
            tail += 1
            
    return cnt