#T224. 糖果
糖果
Description
Due to his immense contributions in maintaining world peace, Dzx was awarded an unlimited free candy coupon from the Candy Company for the entire day of May 23, 2010.
On this day, Dzx can choose any number of products from the N items offered by the Candy Company to take home and enjoy. Each of the N products contains a different amount of candy. Dzx hopes that the total number of candies in the selected products is a multiple of K, so that he can fairly distribute the candies among his partners who helped him maintain world peace.
Of course, while satisfying this condition, the more candies the better. What is the maximum number of candies Dzx can take away?
Note: Dzx can only take whole products from the Candy Company.
Input Format
The first line contains two integers N (1 ≤ N ≤ 100) and K (1 ≤ K ≤ 100).
The following N lines each contain one integer, representing the number of candies in the corresponding product from the Candy Company. The number does not exceed 1,000,000.
Output Format
The maximum total number of candies that meets the requirement. If it is impossible to satisfy the condition of being a multiple of K, output 0.
5 7
1
2
3
4
5
14
Hint
Dzx's choice is 2 + 3 + 4 + 5 = 14, which makes the total number of candies a multiple of 7, and this is the selection with the highest possible total.