Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
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~ (0 < N < ~10^{5}~, 0 < K <~10^{18}~, v < ~10^{4}~) 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.
Output
- Output the number ~v~ as the price of the selected gift. If Beo cant buy any gift, output -1.
Sample Input:
5 100
10
20
30
40
50
Sample Output:
50
Bình luận