A. Devu, the Singer and Churu, the Joker



time limit per test



memory limit per test



input



output


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.

n songs, ith song will take ti

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:

  • d
  • 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



nd (1 ≤ n ≤ 100; 1 ≤ d ≤ 10000). The second line contains n space-separated integers: t1, t2, ..., tn (1 ≤ ti.


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



30 minutes. There could be maximum 5

  • 5
  • 2
  • 2 jokes in 10
  • 2
  • 2 jokes in 10
  • 1

5 + 2 + 10 + 2 + 10 + 1 = 30

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



标签虽然要用贪心,但是不用也可以!

#include<stdio.h>
int main()
{
int n,d,s=0,x;
scanf("%d%d",&n,&d);
for(int i=0; i<n; i++)
{
scanf("%d",&x);
s+=x;
}
int w=(n-1)*10;
if(w+s>d)
{
printf("-1\n");
return 0;
}
if(d-w-s>=5)
printf("%d\n",(n-1)*2+(d-w-s)/5);
else
printf("%d\n",2*(n-1));
return 0;
}