Codeforces Round 251 (Div. 2)
A
Devu, the Singer and Churu, the Joker
Codeforces
900
原题
←B →
翻译中…

Devu is a renowned classical singer. He is invited to many big functions/festivals. Recently he was invited to "All World Classical Singing Festival". Other than Devu, comedian Churu was also invited.

翻译中…

Devu has provided organizers a list of the songs and required time for singing them. He will sing $*n*$ songs, $*i*^{*th*}$ song will take $*t*_{*i*}$ minutes exactly.

翻译中…

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

翻译中…

People have mainly come to listen Devu. But you know that he needs rest of 10 minutes after each song. On the other hand, Churu being a very active person, doesn't need any rest.

翻译中…

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

翻译中…
  • The duration of the event must be no more than $*d*$ minutes;
  • Devu must complete all his songs;
  • With satisfying the two previous conditions the number of jokes cracked by Churu should be as many as possible.
翻译中…

If it is not possible to find a way to conduct all the songs of the Devu, output -1. Otherwise find out maximum number of jokes that Churu can crack in the grand event.

翻译中…

Input

翻译中…

The first line contains two space separated integers $*n*$, $*d*$ $(1 ≤ *n* ≤ 100; 1 ≤ *d* ≤ 10000)$. The second line contains $*n*$ space-separated integers: $*t*_{1}, *t*_{2}, ..., *t*_{*n*}$ $(1 ≤ *t*_{*i*} ≤ 100)$.

翻译中…

Output

翻译中…

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

翻译中…

Note

翻译中…

Consider the first example. The duration of the event is $30$ minutes. There could be maximum $5$ jokes in the following way:

翻译中…
  • First Churu cracks a joke in $5$ minutes.
  • Then Devu performs the first song for $2$ minutes.
  • Then Churu cracks $2$ jokes in $10$ minutes.
  • Now Devu performs second song for $2$ minutes.
  • Then Churu cracks $2$ jokes in $10$ minutes.
  • Now finally Devu will perform his last song in $1$ minutes.
翻译中…

Total time spent is $5 + 2 + 10 + 2 + 10 + 1 = 30$ minutes.

翻译中…

Consider the second example. There is no way of organizing Devu's all songs. Hence the answer is -1.

翻译中…

样例

Input #1
3 30
2 2 1
Output #1
5
InputCopy OutputCopy
Input #2
3 20
2 1 1
Output #2
-1
InputCopy OutputCopy
题目信息
题号
439A
时间限制
1 s
内存限制
256 MB
标签
贪心
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。