5614: 歌手Devu和小丑Churu

内存限制:256 MB 时间限制:2 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:6 通过:2

题目描述

Devu是一位著名的古典歌手。他被邀请参加许多大型活动/节日。最近,他被邀请参加 "全世界古典歌唱节"。除Devu外,喜剧演员Churu也被邀请。
Devu已经向组织者提供了一份歌曲清单和所需的演唱时间。他将演唱N首歌曲,每首歌曲都需要精确的时间。
喜剧演员Churu将讲笑话。他的所有笑话都是5分钟的。
人们主要是来听Devu的。但你知道,他在每首歌之后需要休息10分钟。另一方面,Churu是一个非常活跃的人,不需要任何休息。
作为组织者之一,你应该为活动制定一个最佳时间表。由于某些原因,您必须遵循这些条件。

    活动的时间不能超过d分钟。
    Devu必须完成他的所有歌曲。
    在满足前面两个条件的情况下,Churu所讲的笑话数量应尽可能多。

如果不可能找到一个方法来进行Devu的所有歌曲,则输出-1。否则,找出Churu在盛会中能开出的最大笑话数。


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, ith song will take ti 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 schedule 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: t1,t2,...,tn (1≤ti≤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.
Examples
Input
3 30
2 2 1
Output
5
Input
3 20
2 1 1
Output
-1
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.

输入格式

第一行包含两个空格分隔的整数n,d(1≤n≤100;1≤d≤10000)。第二行包含n个空格分隔的整数:t1,t2,...,tn(1≤ti≤100)。

输出格式

如果没有办法进行Devu的所有歌曲,输出-1。否则输出Churu在盛会中能开出的最大笑话数。

输入样例 复制

3 30
2 2 1

输出样例 复制

5

数据范围与提示

考虑第一个样例。活动的持续时间是30分钟。最多可以有5个笑话,方法如下。

    首先,Churu在5分钟内讲了一个笑话。
    然后Devu表演了2分钟的第一首歌。
    然后Churu在10分钟内讲了两个笑话。
    现在Devu表演第二首歌,时间为2分钟。
    然后Churu在10分钟内讲了两个笑话。
    现在,Devu将在1分钟内表演他的最后一首歌。

总时间为5+2+10+2+10+1=30分钟。
考虑第二个样例。没有办法将Devu的所有歌曲组织起来。因此,答案是-1。