The best team
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Today, programmers have gathered. Each programmer has a rating that reflects his strength. The rating is an integer between and . Your rating as a programmer is . From all the programmers gathered today, you want to choose two for your team. They must be selected in such a way that their total rating is maximized but does not exceed your rating, as you want to be the leader of this team.
Input
The first line contains two integers: — the number of programmers, and — your rating. The second line contains integers — the ratings of the programmers.
Output
Print a single integer — the maximum sum of the ratings of the selected programmers, or if it is impossible to find such two people.
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Submissions 4K
Acceptance rate 27%