Changu Mangu in IndiaHacks

4.5

4 votes
Problem

Changu is a renowned classical singer. He is invited to many big functions/festivals. Recently he was invited to IndiaHacks 2016. Other than Changu, comedian Mangu was also invited.

Changu has provided organizers a list of the songs and required time for singing them. He will sing n songs, ith song will take ti minutes exactly.

The Comedian, Mangu will crack jokes. All his jokes are of 5 minutes exactly.

Participants apart from taking part in the contests have mainly come to listen Changu. But you know that he needs rest of 10 minutes after each song. On the other hand, Mangu takes Revital (jiyo jee bhar ke), so he doesn't need any rest.

You as one of the organizers should make an optimal schedule for the event. For some reasons you must follow the conditions:

The duration of the IndiaHacks2016 event must be no more than d minutes; Changu must complete all his songs; With satisfying the two previous conditions the number of jokes cracked by Mangu should be as many as possible. If it is not possible to find a way to conduct all the songs of the Changu, output -1. Otherwise find out maximum number of jokes that Mangu can crack in the grand event.

Input The first line contains t the number of test cases. Followed by two space separated integers n, d (1 ≤ n ≤ 100; 1 ≤ d ≤ 10000). The second line contains n space-separated integers: t1, t2, ..., tn (1 ≤ ti ≤ 100).

Output If there is no way to conduct all the songs of Changu, output -1. Otherwise output the maximum number of jokes that Mangu can crack in the grand event.

Note : To enjoy event with Changu and Mangu you can also register for IndiaHacks 2016.


Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?