Wcipeg 2017-2018 Test
Self-Balancing Budget
Geresh is applying for a specialized program at a certain high school. In order to be accepted, he must bribe teachers to give him good references. He needs references from N teachers, and each teacher has some price Pi which must be given to the teacher in secret. Fortunately, the right honourable Trustin Judeau has been blackmailed donated to Geresh a limited budget of B dollars.
Geresh wants to find out if he will have enough money to buy all the references he needs.
Input Format
The first line of input contains the integers N (1 ≤ N ≤ 10000) and B (0 ≤ B ≤ 106). The next N lines contain the integers Pi (1 ≤ Pi ≤ 106).
Output Format
If Geresh will not have enough money to bribe all the teachers, output "The budget will balance itself". Otherwise, output the amount of money he will have remaining after bribing each teacher.
Sample Input 1
2 10 5 4
Sample Output 1
1
Sample Input 2
1 10 1000
Sample Output 2
The budget will balance itself
All Submissions
Best Solutions
Point Value: 3
Time Limit: 2.00s
Memory Limit: 256M
Added: Dec 05, 2017
Author: kxoraxe
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
It's quiet in here...