Question
The Archer's Target Pairing

An archery coach has N arrows, each landing at a score position A_i on a scoring line (positions can be negative, representing shots that landed past the center in the opposite direction). The coach wants to pair up exactly two arrows such that the sum of their scores is as close as possible to a target sum K.

Find the achievable sum (from some pair of two distinct arrows) that is closest to K. If more than one achievable sum is equally close to K, report the smaller of the tied sums.

Input

The first line contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression — the number of arrows and the target sum.

The second line contains KaTeX can only parse string typed expression integers KaTeX can only parse string typed expression.

Output

Print a single integer — the achievable pair-sum closest to KaTeX can only parse string typed expression (smallest such sum if there is a tie).

Example
Example 1:
Input
6 54

10 22 28 29 30 40
Output
52
Explanation
The pair KaTeX can only parse string typed expression is the closest achievable sum to KaTeX can only parse string typed expression.

Example 2:
Input
11 18

2 -3 5 30 29 15 -16 -28 17 -1 23
Output
17
Explanation
Both KaTeX can only parse string typed expression and KaTeX can only parse string typed expression are exactly distance 1 from the target 18. Since they are tied, the smaller value, KaTeX can only parse string typed expression, is reported.

Example 3:
Input
2 0

-5 5
Output
0
Explanation
The only possible pair sums to exactly KaTeX can only parse string typed expression, matching the target exactly.

Online