1048. Find Coins (25)
Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However, there was a special requirement ofthe payment: foreach bill, she could only use exactly two coins to pay the exact amount. Since she has as many as105 coins with her, she definitely needs your help. You are supposed to tell her, forany given amount of money, whether ornot she can find two coins to pay forit.
Each input filecontainsone test case. For eachcase, thefirstlinecontains2 positive numbers: N (<=105, the total numberof coins) and M(<=103, the amount of money Eva has to pay). The secondlinecontains N face values ofthe coins, which are all positive numbers no more than 500. All the numbers inaline are separated byaspace.
For each test case, print inonelinethetwo face values V1 and V2 (separated byaspace) such that V1 + V2 = M and V1 <= V2. If such a solution is not unique, output theonewiththe smallest V1. If there is no solution, output "No Solution" instead.
Sample Input 1:
Sample Output 1:
Sample Input 2:
Sample Output 2: