Gửi bài giải

Điểm: 1,50 (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:
Ha Minh Ngoc
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Women's day is coming soon, Beo wants to buy gifts for his mother and his sister. Beo want to buy two gifts with similar prices but he has only ~K~ VND. He went to the XYZ store,where there were ~N~ items.

Help Beo to choose gifts so that the total price is largest but does not exceed the amount of Beo has, and the difference between the two gifts is the smallest.

Input

  • The first line contains an integer ~N~ and ~K~. ~N~ is the number of items in the store and ~K~ is the amount of money Beo has

  • The ~ith~ line of the next ~N~ lines contains an integer which are price of the items. (0 < N ≤ ~10^{5}~,1K ≤ ~10^{9}~, 0 < ~a_i~ ≤ ~10^{5}~).

Output

Output the total amount of money to be spent and the difference between the two gifts (non-negative). If it is not able to select gifts, output "-1 -1".

Sample Input:

5 100

10 50 60 40 50 

Sample Output:

100 0

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.