rohan-and-flower

My dear friend Rohan likes flower very much. One day someone gifted him a bunch of flowers and a cake. Each flower in the bunch has some beauty level B[i]. The cake also has sweetness level K. Now Rohan is slightly superstitious so he decided to pick three flowers from the bunch such that the product of their beauty is exactly divisible by the happiness of the cake. Now Rohan is wondering in how many ways he can accomplice this. He has asked you to help him.

Input:

An integer denoting number of flowers, N

On next line an integer denoting K

Next line contain N positive integers denoting the beauty of flowers.

Output:

Contains the required  number of ways in one line.

Constraint:

2 < N < 2,000

0 < B[i] < 100,000,000

0 < K < 10,00,000

SAMPLE INPUT
4
100
25 2 4 5

SAMPLE OUTPUT
2

Source: hackerearth | Difficulty: MEDIUM


Solutions: