Submit | All submissions | Best solutions | Back to list |
EIULOVE - Valentine |
The Valentine's Day is coming, Mr. Beo wants to buy gifts for his girlfriend. Beo loves her so much that he wants to buy a special gift. However, Beo only has K VND in his pocket. He wants to use K Dong to buy gifts at the store. Help him choose the most expensive item he can afford
Input
The first line gives integers N and K. N is the number of items in the store and K is the amount Beo has
The ith line in the following N lines contains an integer who is the value of the ith item
(0<N<10^5, 0<K<10^18, v<10^4)
Output
Output the number v as the price of the selected gift. If Beo can't buy any gift, output -1.
Example
Input: 5 100 10 20 30 40 50 Output:50