IntermediateRating 1300
Three Numbers Closest to Target
Choose three numbers (different positions) whose sum is as close as possible to t. Print that sum (if two sums are equally close, print the smaller one).
Input
n and t, then n integers (n ≤ 500).
Output
One integer.
Sample 1
Input
4 1 -1 2 1 -4
Output
2
Sample 2
Input
3 1 0 0 0
Output
0
Output appears here