#t422. 糖果

糖果

Candies

Problem Description

Because of his great contribution to keeping the world at peace, Dzx was given an unlimited free coupon from the candy company, valid on May 23, 2010. On that day Dzx may choose any subset of the company's NN products and take them home. The NN products each contain a certain number of candies. Dzx wants the total number of candies in the chosen products to be a multiple of KK, so that he can share the candies equally with the partners who helped him keep the peace. Subject to this condition, the larger the total, the better. What is the maximum number of candies Dzx can take home?

Note: Dzx can only take a whole product — he cannot split a product.

Input Format

The first line contains two integers NN (1≤N≤1001 \le N \le 100) and KK (1≤K≤1001 \le K \le 100).

The next NN lines each contain one integer: the number of candies in that product, not exceeding 10000001000000.

Output Format

The maximum total number of candies satisfying the requirement. If no subset has a total that is a multiple of KK, output 00.

Sample Input

5 7
1
2
3
4
5

Sample Output

14

Hint

Dzx's choice is 2+3+4+5=142+3+4+5=14, so the total is a multiple of 77, and it is the choice with the largest possible total.

Limitation

1 s, 1024 KiB for each test case.