Sodium Intake
Kate wants to eat another bag of sea salt chips, but has been told by her doctor to watch her sodium intake! To make sure that she does, Kate assigns a sodium value to each chip, that way she can make sure that she eats the recommended amount. However, Kate knows that good things come in multiples, so eating any multiple of the recommended amount is A-Ok with her!
Help Kate find the longest contiguous subsequence of chips that she can eat, given the sodium values of each chip, and the recommended sodium intake by her doctor!
Input
The first line contains two integers and
(
,
), representing the number of chips in the bag and the recommended daily intake of sodium.
The next line contains space-separated integers
(
), representing the sodium content of each of the
chips.
Output
Output a single integer - the length of the longest contiguous subsequence of chips where the sum of sodium contents is a multiple of the recommended sodium intake. If no non-empty contiguous subsequence satisfies this, output 0.
Example
Input 1
5 4
9 3 1 4 2
Output 1
3
, which is a multiple of the recommended intake,
. It is provable this is the longest such contiguous subsequence where this is the case.
Input 2
6 5
3 5 10 1 4 2
Output 2
6
Comments