Write code to solve it in python. Vasya is delighted with the it game “Vormix”. He has…
- User
Write code to solve it in python. Vasya is delighted with the it game “Vormix”. He has already reached a significant level, so he can open a boss fight. To open a new fight, he needs to score at least K points for missions. It is known that there are N missions in total. For each mission it is known how long it will take to complete it and how many points will be awarded for it. It is also known that Vasya is a very good player, so he can easily pass any mission.
Unfortunately, he doesn't have time to complete all the missions, but he really wants to open the boss fight, so he wants to find out for what minimum period of time he will be able to get at least K points.
Input The first line contains two integers N and K (1 ≤ N ≤ 100 - the number of missions, 0 ≤ K ≤ 10000 - the number of points you need to score to open the boss fight). The next N lines contain two integers each: a[i] - the number of points you can get for passing the i-th mission and t[i] - the time needed to pass it, 0 < a[i], t[i] ≤ 100.
Output Print the minimum time for which Vasya can get at least K points, or “-1” if it is impossible.
Examples Input #1 4 10 5 5 3 1 10 10 7 6 Answer #1 7
- Assistant