Problem

3 /11


Subsequence length

Theory Click to read/hide

Subsequence length
If the subsequence starts with the first element, then its length is equal to the numberof the last number read (if the first element has the number 1).

Problem

Given a sequence of N natural numbers. All its continuous subsequences starting from the first element of the sequence are considered. Find the maximum length of a subsequence with the sum of elements divisible by K. The length of a subsequence is equal to the number of elements in it.

Input
The first line contains two numbers: the number of numbers in the sequence N (1 <= N <= 108) and the number ( 1 <= K <= 100). Next comes N lines, one natural number per line. Each number does not exceed 10000.

Imprint
Print one number on the screen - the number of elements in the found subsequence.
 
Examples
# Input Output
1 5 3
33
41
19
22
40
3