#P2035. 汛期-2
汛期-2
Description
August is during the flood season, and BJ City experienced severe flooding. Xiao Wei needs to help carry the sandbag. The capacity of the river gate where flood occurs is (positive integer, ), and there are sandbags (), each with a volume (positive integer).
Xiao Wei will take any number of sandbags from and move them into the river gate, with the remaining space at the gate being the smallest.
Input Format
On the first line, enter and to represent the total amount of sandbags and the capacity of the river gate during flood season
The second line contains n integers, and the i number represents the volume of the i sandbag
Output Format
Only one integer per line represents the remaining space of the smallest flood channel gate.
Example
Input Example
6 24
8 3 12 7 9 7
Output Example
0