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.


-----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.

Source: codeforces | Difficulty: EASY
Tags: Implementation

Greedy algorithms


Solutions:
(n, d) = map(int, input().split())
l = sum(map(int, input().split()))
if l + n * 10 - 10 > d:
	print(-1)
else:
	print((d - l) // 5)


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
time = sum(t) + 10 * (len(t) - 1)
if d < time:
	print(-1)
else:
	print(2 * (len(t) - 1) + (d - time) // 5)


a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(b) + (a[0] - 1) * 10 > a[1]:
	print(-1)
else:
	print((a[1] - sum(b)) // 5)


i = lambda : map(int, input().split())
(n, d) = i()
d -= sum(i())
print([d // 5, -1][d < 10 * ~-n])


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
s = sum(t)
d -= s
if d >= (n - 1) * 10:
	print(d // 5)
else:
	print(-1)


s1 = input().split(' ')
n = int(s1[0])
d = int(s1[1])
s2 = input().split(' ')
s2 = [int(i) for i in s2]
for i in s2:
	d = d - i
if d > 0:
	q = 10 * (n - 1)
	j = n - 1 + n - 1
	d = d - q
	if d > 0:
		while d >= 5:
			d = d - 5
			j += 1
		print(j)
	elif d == 0:
		print(j)
	else:
		print('-1')
elif d == 0:
	if n == 1:
		print('0')
	else:
		print('-1')
else:
	print('-1')


b = [int(b) for b in input().split()]
n = b[0]
d = b[1]
c = [int(c) for c in input().split()]
sum = 0
for i in range(n):
	sum = sum + c[i]
if sum + (n - 1) * 10 > d:
	print(-1)
else:
	print((d - sum) // 5)


l = list(map(int, input().split(' ')))
n = l[0]
d = l[1]
a = list(map(int, input().split(' ')))
if sum(a) + 10 * (n - 1) > d:
	print('-1')
else:
	k = sum(a) + 10 * (n - 1)
	l = d - k
	print((n - 1) * 2 + int(l / 5))


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
if (a - 1) * 10 + sum(l) > b:
	print('-1')
else:
	x = (a - 1) * 10 + sum(l)
	y = b - x
	z = y // 5
	print(z + 2 * (a - 1))


def answer(n, d, t_ary):
	sum = 0
	num_jokes = 0
	for e in t_ary:
		sum += e + 10
		num_jokes += 2
	num_jokes -= 2
	sum -= 10
	if sum > d:
		return -1
	time_rem = d - sum
	jokes_rem = time_rem // 5
	num_jokes += jokes_rem
	return num_jokes

def main():
	(n, d) = [int(i) for i in input().split()]
	t_ary = [int(i) for i in input().split()]
	print(answer(n, d, t_ary))
main()


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
a = sum(l)
r = d - a
if r < (n - 1) * 10:
	print('-1')
else:
	print(r // 5)


def max_songs(n, k, songs):
	rest = 10 * (n - 1)
	total = rest + sum(songs)
	if total > k:
		return -1
	else:
		return (k - total + rest) // 5

def main():
	(n, k) = [int(i) for i in input().split()]
	s = [int(i) for i in input().split()]
	print(str(max_songs(n, k, s)))
main()


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
jokes = 0
x = sum(t) + (n - 1) * 10
x = d - x
if x < 0:
	print(-1)
else:
	jokes += x // 5 + 2 * (n - 1)
	print(jokes)


(n, d) = map(int, input().split())
a = sum(list(map(int, input().split())))
if (n - 1) * 10 + a > d:
	print(-1)
	exit()
else:
	print((d - a) // 5)


(n, d) = map(int, input().split())
t = [int(t) for t in input().split()]
s = sum(t) + 10 * (n - 1)
res = 0
if s > d:
	res = -1
else:
	s = sum(t)
	res = int((d - s) / 5)
print(res)


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
temp = sum((t[i] for i in range(n))) + (n - 1) * 10
if temp > d:
	print(-1)
else:
	res = (n - 1) * 2 + (d - temp) // 5
	print(res)


(n, t) = map(int, input().split())
l = [int(i) for i in input().split()]
if sum(l) + 10 * (n - 1) > t:
	print(-1)
else:
	rem = t - sum(l)
	print(rem // 5)


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
if sum(arr) + (n - 1) * 10 > d:
	print(-1)
else:
	ans = (d - sum(arr)) // 5
	print(ans)


buf = input().split(' ')
n = int(buf[0])
k = int(buf[1])
czas = 0
buf = input().split(' ')
for i in range(n):
	t = int(buf[i])
	czas += t
czas += (n - 1) * 10
if czas > k:
	print(-1)
else:
	print((k - czas) // 5 + 2 * (n - 1))


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
devu_time = sum(l) + (n - 1) * 10
print(-1 if devu_time > d else (n - 1) * 2 + (d - devu_time) // 5)


(n, d) = [int(x) for x in input().split()]
min = 10 * (n - 1)
a = [int(x) for x in input().split()]
for i in range(n):
	min = min + a[i]
if min > d:
	print(-1)
else:
	count = 2 * (n - 1) + (d - min) // 5
	print(count)


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
ans = d - sum(t)
if ans - 10 * (n - 1) >= 0:
	print(ans // 5)
else:
	print(-1)


(n, d) = [int(x) for x in input().split(' ')]
song_time = [int(y) for y in input().split(' ')]
if 10 * (n - 1) + sum(song_time) > d:
	print(-1)
else:
	print((d - sum(song_time)) // 5)


import math
inp = input().split()
n = int(inp[0])
d = int(inp[1])
arr = input().split()
time = 0
jokes = 0
for ch in arr:
	time += int(ch)
time += (n - 1) * 10
jokes += (n - 1) * 2
if time > d:
	print('-1')
else:
	jokes += math.floor((d - time) / 5)
	print(str(jokes))


(n, m) = map(int, input().split())
x = list(map(int, input().split()))
if sum(x) + (n - 1) * 10 > m:
	print(-1)
else:
	m = (m - sum(x)) // 5
	print(m)


s = [int(i) for i in input().split()]
t = list(map(int, input().split()))
a = sum(t)
x = (s[1] - a) // 5
if (s[0] - 1) * 2 > x:
	print(-1)
else:
	print(x)


(song_number, duration_of_func) = input().split()
song_times = []
song_times = input().split()
rest = 10
song_total = 0
i = 0
while i < len(song_times):
	song_total += int(song_times[i])
	i += 1
Devu_time = rest * (int(song_number) - 1) + song_total
if Devu_time <= int(duration_of_func):
	Churu_time = (int(duration_of_func) - song_total) / 5
	print(int(Churu_time))
else:
	print('-1')


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
(nb_songs, total_time) = read_ints()
song_length = read_ints()
time_for_jokes = total_time - sum(song_length)
if time_for_jokes >= (nb_songs - 1) * 10:
	print(time_for_jokes // 5)
else:
	print(-1)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
sum1 = sum(a)
count = 2 * (len(a) - 1)
if sum1 + 10 * (len(a) - 1) > d:
	print('-1')
elif sum1 + 10 * (len(a) - 1) <= d:
	d = d - (sum1 + 10 * (len(a) - 1))
	count = count + d // 5
	print(count)


(n, d) = map(int, input().split())
lst = list(map(int, input().split()))
x = len(lst) - 1
time_uesd = sum(lst) + 10 * x
time_conlai = d - time_uesd
if time_conlai >= 0:
	print(x * 2 + time_conlai // 5)
else:
	print(-1)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
s1 = 0
if sum(l) + (len(l) - 1) * 10 > d:
	print(-1)
else:
	for i in range(len(l)):
		d -= l[i]
		s1 += 2
		d -= 10
	s1 += d // 5
	print(s1)


times = input().split()
minutes = input().split()
total_minutes = 0
for i in minutes:
	total_minutes += int(i)
if (int(times[0]) - 1) * 10 + total_minutes > int(times[1]):
	print('-1')
else:
	print((int(times[1]) - total_minutes) // 5)


def main():
	(n, d) = map(int, input().split())
	t = list(map(int, input().split()))
	sm = sum(t)
	if sm + 10 * (n - 1) > d:
		print(-1)
	else:
		print((d - sm) // 5)
main()


(a, b) = map(int, input().split())
l = [int(i) for i in input().split()]
if (a - 1) * 10 + sum(l) > b:
	print(-1)
else:
	b -= sum(l)
	print(b // 5)


def solve():
	(n, d) = map(int, input().split())
	t = list(map(int, input().split()))
	if 10 * (n - 1) + sum(t) > d:
		return -1
	else:
		return (d - sum(t)) // 5
print(solve())


a = list(map(int, input().split()))
n = a[0]
d = a[-1]
plus = 2 * (n - 1)
total = d - 10 * (n - 1)
b = list(map(int, input().split()))
sums = sum(b)
if sums <= total:
	print(int((total - sums) / 5) + plus)
else:
	print(-1)


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
count = 0
flag = 1
for i in range(n):
	d = d - arr[i]
	if d < 0:
		flag = 0
		break
	d = d - 10
	count += 2
if i == n - 1 and d < 0 and (flag == 1):
	d += 10
	count -= 2
	a = d // 5
	print(count + a)
elif flag == 0:
	print(-1)
elif d > 0 and i == n - 1:
	a = d // 5
	count += a
	print(count)


(n, d) = map(int, input().split())
t = [int(i) for i in input().split()]
s = sum(t) + (n - 1) * 10
jt = (d - sum(t)) // 5
if s <= d:
	print(jt)
else:
	print(-1)


a = input().split()
b = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
for i in range(len(b)):
	b[i] = int(b[i])
if sum(b) + (len(b) - 1) * 10 > a[1]:
	print('-1')
else:
	print((a[1] - sum(b)) // 5)


def maxJokes(n, li, d):
	s = 0
	for i in range(n):
		s += li[i]
	if s + 10 * (n - 1) > d:
		return -1
	else:
		return (d - s) // 5
(n, d) = input().split()
li = [int(x) for x in input().split()]
print(maxJokes(int(n), li, int(d)))


def inp():
	return map(int, input().split())

def arr_inp():
	return [int(x) for x in input().split()]
(n, d) = inp()
t = arr_inp()
devu = sum(t) + (n - 1) * 10
if devu > d:
	print(-1)
else:
	ans = (d - sum(t)) // 5
	print(ans)


(n, d) = list(map(int, input().split()))
C = list(map(int, input().split()))
sumC = 0
_Ans = True
for i in range(n):
	sumC += C[i]
if sumC + 10 * (n - 1) > d:
	_Ans = False
if not _Ans:
	print(-1)
else:
	print(int((d - sumC) / 5))


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
total = (n - 1) * 10 + sum(t)
if total > d:
	print(-1)
else:
	print((n - 1) * 2 + (d - total) // 5)


def solve(ls, n, d):
	tot = (n - 1) * 10 + sum(ls)
	if tot > d:
		return -1
	return (n - 1) * 2 + (d - tot) // 5
(n, d) = list(map(int, input().split()))
ls = list(map(int, input().split()))
print(solve(ls, n, d))


(n, d) = map(int, input().split())
seconds = list(map(int, input().split()))
if d - sum(seconds) - (n - 1) * 10 < 0:
	print(-1)
elif d - sum(seconds) - (n - 1) * 10 == 0:
	print((n - 1) * 2)
else:
	sumd = d - sum(seconds) - (n - 1) * 10
	k = (n - 1) * 2
	sumd = sumd // 5
	k = k + sumd
	print(k)


(n, d) = map(int, input().split())
song = [int(i) for i in input().split()]
jokes = 0
sum_song = 0
for x in range(len(song)):
	sum_song += song[x]
if sum_song + (n - 1) * 10 <= d:
	jokes = (d - sum_song) // 5
	print(jokes)
else:
	print(-1)


(n, d) = map(int, input().split())
songs = map(int, input().split())
timeDeva = sum(songs)
timeChuru = (n - 1) * 10
if timeChuru + timeDeva <= d:
	ost = d - timeDeva - timeChuru
	print((n - 1) * 2 + ost // 5)
else:
	print(-1)


(n, d) = map(int, input().split())
t = [int(x) for x in input().split()]
if d < sum(t) + 10 * (n - 1):
	print(-1)
else:
	print(2 * (n - 1) + (d - (sum(t) + 10 * (n - 1))) // 5)


x = input()
x = x.split()
n = int(x[0])
d = int(x[1])
x = input()
x = x.split()
t = list((int(x[i]) for i in range(len(x))))
sum = 0
for i in range(len(t)):
	sum = sum + t[i]
if sum + 10 * (n - 1) > d:
	print(-1)
else:
	print((d - sum) // 5)


(n, d) = list(map(int, input().split()))
t = list(map(int, input().split()))
a = (len(t) - 1) * 10
d_song = sum(t, a)
b = d - d_song
if d_song > d:
	print('-1')
else:
	c_jokes = (a + b) // 5
	print(c_jokes)


def main():
	first_input = list(map(lambda x: int(x), input().split(' ')))
	second_input = list(map(lambda x: int(x), input().split(' ')))
	time_rest = (first_input[0] - 1) * 10
	time_event = first_input[1]
	time_music = sum(second_input)
	time_left = time_event - time_music - time_rest
	if time_left < 0:
		return -1
	number_jok = time_rest / 5 + time_left / 5
	return int(number_jok)
print(main())


(nyanyi, waktu) = map(int, input().split())
x = list(map(int, input().split()))
if (len(x) - 1) * 10 + sum(x) > waktu:
	print(-1)
else:
	print(int((waktu - sum(x)) / 5))


import math
try:
	B = list(map(int, input().split()))
	N = B[0]
	D = B[1]
	A = list(map(int, input().split()))
	if (N - 1) * 10 + sum(A) > D:
		print('-1')
	else:
		rem = D - sum(A)
		print(math.floor(rem / 5))
except:
	print('000')


n = list(map(int, input().split()))
t = list(map(int, input().split()))
s = (n[0] - 1) * 10
r = s
flag = 1
for i in range(len(t)):
	s += t[i]
	if s > n[1]:
		flag = 0
		break
if flag == 0:
	print('-1')
else:
	print(r // 5 + (n[1] - s) // 5)


def solve(ts, d):
	k = len(ts) - 1
	sum_ts = sum(ts)
	minimum_event = sum_ts + 10 * k
	if d < minimum_event:
		return -1
	else:
		return 2 * k + (d - minimum_event) // 5

def main():
	[n, d] = [int(i) for i in input().strip().split()]
	ts = [int(i) for i in input().strip().split()]
	assert len(ts) == n
	result = solve(ts, d)
	print(result)
main()


l1 = input().split()
n = int(l1[0])
d = int(l1[1])
t = [int(i) for i in input().split()]
if sum(t) + 10 * (n - 1) > d:
	print(-1)
else:
	print(int((d - sum(t)) / 5))


import os
import sys
from io import BytesIO, IOBase
import math as M
import itertools as ITR
from collections import defaultdict as D
from collections import Counter as C
from collections import deque as Q
import threading
from functools import lru_cache, reduce
from functools import cmp_to_key as CMP
from bisect import bisect_left as BL
from bisect import bisect_right as BR
import random as R
import string
import cmath, time
enum = enumerate
start_time = time.time()
MOD = 1000000007
MA = float('inf')
MI = float('-inf')
di8 = ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1))
di4 = ((1, 0), (0, 1), (-1, 0), (0, -1))

def increase_stack():
	sys.setrecursionlimit(2 ** 32 // 2 - 1)
	threading.stack_size(1 << 27)

def binary(n):
	return bin(n)[2:]

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def maxfactor(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
	if q:
		return q[-1]

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	l.sort()
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def seive(n):
	a = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for p in range(2, n + 1):
		if prime[p]:
			a.append(p)
	prime[0] = prime[1] = False
	return (a, prime)

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countchar(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def str_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def lis(arr):
	n = len(arr)
	lis = [1] * n
	maximum = 0
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
				maximum = max(maximum, lis[i])
	return maximum

def lcm(arr):
	a = arr[0]
	val = arr[0]
	for i in range(1, len(arr)):
		gcd = gcd(a, arr[i])
		a = arr[i]
		val *= arr[i]
	return val // gcd

def ncr(n, r):
	return M.factorial(n) // (M.factorial(n - r) * M.factorial(r))

def npr(n, r):
	return M.factorial(n) // M.factorial(n - r)

def IF(c, t, f):
	return t if c else f

def YES(c):
	print(IF(c, 'YES', 'NO'))

def Yes(c):
	print(IF(c, 'Yes', 'No'))

def yes(c):
	print(IF(c, 'yes', 'no'))

def JA(a, sep=' '):
	print(sep.join(map(str, a)))

def JAA(a, s='\n', t=' '):
	return s.join((t.join(map(str, b)) for b in a))

def PS(a, s=' '):
	print(str(a), end=s)

def I():
	return int(inp())

def F():
	return float(inp())

def LI():
	return list(map(int, inp().split()))

def LF():
	return list(map(float, inp().split()))

def MATI(n):
	return [LI() for i in range(n)]

def MATS(n):
	return [list(inp()) for i in range(n)]

def IV():
	return map(int, inp().split())

def FV():
	return map(float, inp().split())

def LS():
	return list(inp())

def S():
	return inp()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
inp = lambda : sys.stdin.readline().rstrip('\r\n')
TestCases = 0

def solve():
	(n, d) = IV()
	arr = LI()
	su = sum(arr)
	su += (n - 1) * 10
	res = (n - 1) * 2
	rem = d - su
	if rem < 0:
		print(-1)
		return
	res += rem // 5
	print(res)

def main():
	flag = 1
	try:
		sys.stdin = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/input.txt', 'r')
		sys.stdout = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/output.txt', 'w')
	except:
		flag = 0
	t = 1
	if TestCases:
		t = I()
	for _ in range(1, t + 1):
		solve()
	if flag:
		print('Time: %.4f sec' % (time.time() - start_time))
		localtime = time.asctime(time.localtime(time.time()))
		print(localtime)
		sys.stdout.close()
main()


I = lambda : map(int, input().split())
(n, d) = I()
a = sum(I()) + (n - 1) * 10
print((n - 1) * 2 + (d - a) // 5 if d >= a else -1)


(n, d) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
asum = sum(a)
if asum + 10 * (n - 1) > d:
	print(-1)
else:
	print((d - asum) // 5)


q = lambda : map(int, input().split())
(n, d) = q()
t = (n - 1) * 10 + sum(q())
c = (d - t) // 5
print([-1, (n - 1) * 2 + c][d - t >= 0])


(n, m) = map(int, input().split())
a = input().split()[:n]
sum = 0
for i in range(len(a)):
	sum += int(a[i])
n = n - 1
if m < 10 * n + sum:
	print(-1)
else:
	min = m - sum
	print(int(min // 5))


(a, b) = list(map(int, input().split()))
c = list(map(int, input().split()))
d = sum(c) + (len(c) - 1) * 10
if d > b:
	print(-1)
else:
	print((b - sum(c)) // 5)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
p = d - sum(l)
if sum(l) + (n - 1) * 10 > d:
	print('-1')
else:
	s = (d - sum(l)) // 5
	print(s)


def inpNum():
	return int(input())

def inpNums():
	return map(int, input().split())

def inpList():
	return list(map(int, input().split()))
(n, d) = inpNums()
ni = inpList()
ttl = sum(ni)
tttl = ttl + (len(ni) - 1) * 10
if tttl > d:
	print(-1)
else:
	tttl = d - ttl
	print(tttl // 5)


(n, d) = (int(x) for x in input().split())
mind = sum((int(x) for x in input().split())) + (n - 1) * 10
print(-1 if mind > d else (n - 1) * 2 + (d - mind) // 5)


(sing, duration) = map(int, input().split())
data = [int(i) for i in input().split()]
usedTime = (sing - 1) * 10
for i in data:
	usedTime += i
restTime = duration - usedTime
if restTime < 0:
	print(-1)
else:
	print((sing - 1) * 2 + restTime // 5)


t = input()
temp = t.split()
n = int(temp[0])
d = int(temp[1])
songLenthList = []
songLength = input()
List = songLength.split()
songLenthList = [int(i) for i in List]
devuBreaktime = (n - 1) * 10
devuTotalTime = devuBreaktime + sum(songLenthList)
churuTime = d - devuTotalTime + devuBreaktime
if devuTotalTime > d:
	print(-1)
else:
	print(int(churuTime / 5))


n_d = input('')
n_d_list = list(n_d.split())
(n, d) = (int(n_d_list[0]), int(n_d_list[1]))
time_strng = input('')
time_strng_list = list(time_strng.split())
time = []
for i in range(len(time_strng_list)):
	time.append(int(time_strng_list[i]))
mi = 0
jokes = 0
for j in range(n):
	mi += time[j]
	if j < n - 1:
		jokes += 2
		mi += 10
	else:
		jokes += (d - mi) // 5
if mi > d:
	print(-1)
else:
	print(jokes)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
song = s + (n - 1) * 10
if song <= d:
	print((d - s) // 5)
else:
	print(-1)


def read(mode=2):
	inputs = input().strip()
	if mode == 0:
		return inputs
	if mode == 1:
		return inputs.split()
	if mode == 2:
		return [int(x) for x in inputs.split()]

def write(s='\n'):
	if isinstance(s, list):
		s = ' '.join(s)
	s = str(s)
	print(s, end='')
(n, d) = read()
t = read()
s = sum(t) + 10 * n - 10
if s > d:
	print(-1)
else:
	print((d - sum(t)) // 5)


(n, d) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
z = 0
t = 0
if sum(a) + (len(a) - 1) * 10 > d:
	print(-1)
else:
	d -= sum(a)
	print(d // 5)


from math import *
(n, d) = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a) + (n - 1) * 10
if s > d:
	print(-1)
else:
	ans = (n - 1) * 2 + floor((d - s) / 5)
	print(ans)


data = input().split()
(N, D) = (int(data[0]), int(data[1]))
songs_t = input().split()
songs_t = list(map(int, songs_t))
rest_t = []
jocks_count = 0
for i in range(0, N - 1):
	rest_t.append(songs_t[i] + 10)
	jocks_count += 2
rest_t.append(songs_t[-1])
if sum(rest_t) > D:
	print('-1')
else:
	print(jocks_count + (D - sum(rest_t)) // 5)


(n, d) = map(int, input().split())
l = [int(x) for x in input().split()]
if sum(l) + (n - 1) * 10 > d:
	print(-1)
else:
	d -= sum(l)
	print(d // 5)


(n, d) = map(int, input().split())
a = [int(x) for x in input().split()]
sum = 0
for i in range(n):
	sum += a[i]
if sum + (n - 1) * 10 > d:
	print('-1')
else:
	print(2 * (n - 1) + (d - (sum + (n - 1) * 10)) // 5)


(n, d) = [int(x) for x in input().split()]
times = [int(x) for x in input().split()]
total_time_for_singer = (n - 1) * 10 + sum(times)
if total_time_for_singer > d:
	print(-1)
else:
	print(2 * (n - 1) + (d - total_time_for_singer) // 5)


(no_of_songs, event_duration) = map(int, input().split(' '))
songs = list(map(int, input().split(' ')))
songs_time = sum(songs)
if songs_time + (no_of_songs - 1) * 10 > event_duration:
	print('-1')
else:
	print((event_duration - songs_time) // 5)


(n, d) = list(map(int, input().split()))
t = [int(i) for i in input().split()]
s = 0
for i in range(n):
	s += t[i]
if s + 10 * (n - 1) > d:
	print(-1)
else:
	print(int((d - s) / 5))


line = input()
line = line.split()
n = int(line[0])
d = int(line[1])
line = input()
line = line.split()
tot = 10 * (n - 1)
for i in range(0, n):
	tot = tot + int(line[i])
if tot > d:
	print(-1)
else:
	xtra = d - tot
	jokes = xtra // 5
	jokes = jokes + (n - 1) * 2
	print(jokes)


inp = list(map(int, input().split()))
breaking = inp[0]
d = inp[1]
inp = list(map(int, input().split()))
if (breaking - 1) * 10 + sum(inp) > d:
	print(-1)
else:
	print(int((d - sum(inp)) / 5))


(n, d) = [int(x) for x in input().split()]
t = [int(x) for x in input().split()]
a = sum(t)
rem = d - a
if rem < (n - 1) * 10:
	print(-1)
else:
	print(rem // 5)


(n, d) = list(map(int, input().split()))
t = list(map(int, input().split()))
sum_t = sum(t)
joke_time = (n - 1) * 10
if sum_t + joke_time <= d:
	left = d - (joke_time + sum_t)
	print((joke_time + left) // 5)
else:
	print(-1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) + 10 * (n - 1) > k:
	print(-1)
else:
	print((k - sum(a)) // 5)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
s = sum(l) + (n - 1) * 10
if s <= k:
	print((k - sum(l)) // 5)
else:
	print(-1)


(n, d) = map(int, input().split())
songs = list(map(int, input().split()))
if sum(songs) + 10 * (len(songs) - 1) > d:
	print(-1)
else:
	print((d - sum(songs)) // 5)


(a, b) = input().split()
a = int(a)
b = int(b)
clist = list(map(int, input().split()))
sumi = sum(clist)
d = b - sumi
if d >= (a - 1) * 10:
	print(d // 5)
else:
	print('-1')


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
c = count = i = 0
s = sum(arr)
c = s + (n - 1) * 10
if c <= d:
	count = (10 * (n - 1) + (d - c)) // 5
	print(count)
else:
	print('-1')


(n, d) = map(int, input().split())
t = list(map(int, input().strip().split()))[:n]
count = 0
for i in range(n):
	if t[i] <= d:
		count += 1
		d -= t[i] + 10
	else:
		break
d += 10
if count == n:
	print((count - 1) * 2 + d // 5)
else:
	print(-1)


(n, d) = map(int, input().split())
a = [int(i) for i in input().split()]
t = sum(a)
s = (n - 1) * 10
total = t + s
if d - total < 0:
	print('-1')
else:
	p = d - total
	ans = p // 5 + s // 5
	print(ans)


(n, d) = [int(x) for x in input().split()]
t = [int(x) for x in input().split()]
joke = 0
total = 0
for time in t:
	total += time
	n -= 1
	if n != 0:
		total += 10
		joke += 2
if total > d:
	print(-1)
else:
	print(joke + int((d - total) / 5))


R = lambda : map(int, input().split())
(n, d) = R()
t = list(R())
if sum(t) + 10 * (n - 1) > d:
	print(-1)
else:
	print((d - sum(t)) // 5)


(n, d) = [int(x) for x in input().split(' ')]
t = [int(x) for x in input().split(' ')]
duration = 0
gaps = 0
i = 0
while i < n and t[i] + 10 * int(i > 0) + duration <= d:
	duration += t[i] + 10 * int(i > 0)
	gaps += 10 * int(i > 0)
	i += 1
gaps += d - duration
if i == n:
	ans = gaps // 5
else:
	ans = -1
print(ans)


(n, d) = map(int, input().split())
sp = list(map(int, input().split()))
if sum(sp) + (n - 1) * 10 <= d:
	d -= sum(sp) + (n - 1) * 10
	k = (n - 1) * 2
	k += d // 5
	print(k)
else:
	print(-1)


from sys import stdin

def main():
	(n, d) = map(int, stdin.readline().strip().split())
	d -= sum(map(int, stdin.readline().strip().split())) + n * 10 - 10
	return -1 if d < 0 else n * 2 - 2 + d // 5
print(main())


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
tot = tottime = 0
for i in range(n):
	tot += arr[i]
tottime = tot + (n - 1) * 10
if d < tottime:
	print(-1)
else:
	print((d - tot) // 5)


xy = list(map(int, input().rstrip().split()))
nn = list(map(int, input().rstrip().split()))
dur = xy[1]
flag = 0
tmin = (xy[0] - 1) * 10 + sum(nn)
if tmin > dur:
	print(-1)
	flag = 1
if flag == 0:
	extratime = dur - ((xy[0] - 1) * 10 + sum(nn))
	numjokes = int(extratime / 5) + int((xy[0] - 1) * 2)
	print(numjokes)


def songs(d, arr):
	break_time = (len(arr) - 1) * 10
	if break_time + (sum(arr) - min(arr)) >= d:
		return -1
	ans = 0
	arr.sort()
	while d and arr:
		d -= arr.pop(0)
		ans += 2
		d -= 10
	if d:
		val = d // 5
		ans += val
	return ans
(n, d) = list(map(int, input().rstrip().split()))
arr = list(map(int, input().rstrip().split()))
print(songs(d, arr))


[n, d] = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
sing_time = sum(a) + 10 * (n - 1)
if d < sing_time:
	print(-1)
	exit(0)
print((d - sum(a)) // 5)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
total = d - sum(a)
x = sum(a) + (n - 1) * 10
if x <= d:
	print(total // 5)
else:
	print(-1)


(n, d) = map(int, input().split())
times = list(map(int, input().split()))
rest_time = 10 * (n - 1)
d -= 10 * (n - 1)
for time in times:
	d -= time
if d < 0:
	print(-1)
else:
	print(2 * (n - 1) + d // 5)


(n, d) = list(map(int, input().split(' ')))
x = list(map(int, input().split(' ')))
if d < (n - 1) * 10 + sum(x):
	print(-1)
	exit()
print((d - sum(x)) // 5)


(n, d) = list(map(int, input().split()))
s = list(map(int, input().split()))
m = 10 * (n - 1)
o = m // 5
r = 0
for i in s:
	r = r + i
if r + m <= d:
	v = (d - (r + m)) // 5
	print(v + o)
else:
	print(-1)


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
jokes = 0
d -= t[0]
for k in t[1:]:
	d -= 10
	jokes += 2
	d -= k
if d >= 0:
	jokes += d // 5
else:
	jokes = -1
print(jokes)


(x, y) = map(int, input('').split())
ar = list(map(int, input('').split()))
ct = (len(ar) - 1) * 10 + sum(ar)
if ct > y:
	print(-1)
else:
	a = int((len(ar) - 1) * 10 / 5)
	b = int((y - ct) / 5)
	print(a + b)


(n, d) = map(int, input().split())
ls = list(map(int, input().split()))
ans = []
c = 0
for i in range(n):
	ans.append(ls[i])
	ans.append(10)
	c += 2
del ans[len(ans) - 1]
c -= 2
s = sum(ans)
if s > d:
	print(-1)
else:
	print(c + (d - s) // 5)


(n, d) = map(int, input().split())
lasting = list(map(int, input().split()))
total_songs = sum(lasting)
if total_songs + (n - 1) * 10 > d:
	print(-1)
else:
	print((d - total_songs) // 5)


(n, d) = map(int, input().split())
t4s = list(map(int, input().split()))
totalTime = (n - 1) * 10 + sum(t4s)
if totalTime > d:
	print(-1)
else:
	remainingTime = d - totalTime
	print((n - 1) * 2 + int(remainingTime / 5))


import math

def solve(arr, n, target):
	diff = target - sum(arr)
	mins = 10 * (n - 1)
	if mins > diff:
		return -1
	else:
		return diff // 5
(n, target) = list(map(int, input().strip().split()))
arr = list(map(int, input().strip().split()))
result = solve(arr, n, target)
print(result)


nm = input().split()
n = int(nm[0])
m = int(nm[1])
a = list(map(int, input().rstrip().split()))
if (n - 1) * 10 + sum(a) > m:
	print(-1)
else:
	m = m - sum(a)
	x = m // 5
	print(x)


lis = list(map(int, input().split()))
songs = list(map(int, input().split()))
d = lis[1]
time = 0
count = 0
joke = 5
n = len(songs)
song_time = sum(songs) + (n - 1) * 10
if song_time > d:
	print(-1)
else:
	spare_time = (n - 1) * 10 / 5
	count += spare_time
	rest_time = d - song_time
	count += rest_time // 5
	print(int(count))


from math import floor
(songs, duration) = [int(x) for x in input().split()]
times = [int(x) for x in input().split()]
jokes = 0
while songs:
	songs -= 1
	duration -= times.pop()
	if duration < 0:
		songs += 1
		break
	duration -= 5
	jokes += 1
	if duration < 0:
		jokes -= 1
		break
	duration -= 5
	jokes += 1
	if duration < 0:
		jokes -= 1
		break
	if songs == 0:
		jokes += floor(duration / 5)
if songs != 0:
	print(-1)
else:
	print(jokes)


def main():
	a = list(map(lambda x: int(x), input().split(' ')))
	b = list(map(lambda x: int(x), input().split(' ')))
	sleeps = (a[0] - 1) * 10
	times_mer = a[1]
	ost_times = times_mer - sum(b) - sleeps
	if ost_times < 0:
		return -1
	umor = sleeps / 5
	umor += ost_times / 5
	return int(umor)
print(main())


(n, d) = [int(i) for i in input().split()]
line = [int(i) for i in input().split()]
num = len(line)
time = sum(line) + 10 * (num - 1)
if time > d:
	print('-1')
else:
	print(2 * (num - 1) + (d - time) // 5)


(n, d) = list(map(int, input().split()))
line = list(map(int, input().split()))
if d - (n - 1) * 10 - sum(line) < 0:
	print(-1)
else:
	print((d - sum(line)) // 5)


(n, d) = map(int, input().split())
x = list(map(int, input().split()))
s = sum(x) + (n - 1) * 10
if s > d:
	print(-1)
elif sum(x) == d:
	print(0)
else:
	print((d - sum(x)) // 5)


(n, d) = map(int, input().split())
ts = list(map(int, input().split()))
(rest, joke) = (10, 5)
s = sum(ts)
if (n - 1) * rest + s > d:
	print(-1)
else:
	print((d - s) // joke)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
s = (n - 1) * 2
v = m - sum(a) - s * 5
if v == 0:
	print(s)
elif v / 5 > 0:
	print(s + int(v / 5))
else:
	print(-1)


(n, d) = map(int, input().split())
mins = list(map(int, input().split()))
s = sum(mins)
z = d - (s + (n - 1) * 10)
if z < 0:
	print(-1)
else:
	print((n - 1) * 2 + z // 5)


(n, d) = input().split()
n = int(n)
d = int(d)
arr = input().split()
x = list(map(int, arr))
m = n - 1
t = m * 10
for i in range(n):
	t += x[i]
if not d >= t:
	print(-1)
else:
	r = d - t
	j = m * 2 + int(r / 5)
	print(j)


user_input = input()
numbers = user_input.split(' ')
n = int(numbers[0])
d = int(numbers[1])
total = 0
counter = 0
all = False
user_input = input()
time = user_input.split(' ')
for i in range(n):
	if int(time[i]) > d:
		break
	if total < d and all == False:
		total += int(time[i])
		if total > d:
			break
		if d - total >= 10:
			counter += 2
		elif d - total >= 5:
			counter += 1
		total += 10
	else:
		break
	if i == n - 1:
		total -= 10
		all = True
		break
if all == False:
	print('-1')
else:
	left = d - total - 10
	if left >= 5:
		number = left // 5
		counter += number
	print(counter)


(n, d) = map(int, input().split())
ar = list(map(int, input().split()))
z = sum(ar) + (len(ar) - 1) * 10
if z > d:
	print(-1)
else:
	joke = (len(ar) - 1) * 10 / 5 + (d - z) / 5
	print(int(joke))


(n, d) = map(int, input().split(' '))
mas = list(map(int, input().split(' ')))
if sum(mas) + (len(mas) - 1) * 10 <= d:
	res = (len(mas) - 1) * 2 + (d - sum(mas) - (len(mas) - 1) * 10) // 5
	print(res)
else:
	print(-1)


(n, m) = map(int, input().split())
devu = list(map(int, input().split()))
if sum(devu) + 10 * (n - 1) > m:
	print('-1')
elif m - (sum(devu) + 10 * (n - 1)) >= 0:
	p = (n - 1) * 2 + (m - (sum(devu) + 10 * (n - 1))) // 5
	print(p)


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
cnt = 0
jokes = 0
for i in range(len(t) - 1):
	cnt += t[i] + 10
	jokes += 2
if cnt + t[n - 1] <= d:
	cnt += t[n - 1]
	rem = d - cnt
	jokes += rem // 5
	print(jokes)
else:
	print(-1)


t = list(map(int, input().split()))
s = list(map(int, input().split()))
sum = i = 0
for i in range(t[0]):
	sum = sum + s[i]
	if i != t[0] - 1:
		sum = sum + 10
if sum <= t[1]:
	print((t[0] - 1) * 2 + int((t[1] - sum) / 5))
else:
	print(-1)


(n, d) = input().split()
n = int(n)
d = int(d)
h = list(map(int, input().split()))
if sum(h) + 10 * (n - 1) > d:
	print(-1)
else:
	print(2 * (n - 1) + (d - sum(h) - 10 * (n - 1)) // 5)


(n, d) = [int(x) for x in input().split()]
t = [int(x) for x in input().split()]
print(-1) if sum(t) + (len(t) - 1) * 10 > d else print((d - sum(t)) // 5)


a = list(map(int, input().split()))
n = a[0]
d = a[1]
s = 0
gg = list(map(int, input().split()))
s = sum(gg)
if s + (n - 1) * 10 > d:
	print('-1')
else:
	print((n - 1) * 2 + (d - (s + (n - 1) * 10)) // 5)


(n, d) = [int(x) for x in input().split()]
songs = [int(x) for x in input().split()]
time = sum(songs) + 10 * (n - 1)
if time > d:
	print(-1)
else:
	print((n - 1) * 2 + (d - time) // 5)


def solve(arr, n, d):
	res = sum(arr)
	if res + (n - 1) * 10 > d:
		return -1
	return (d - res) // 5

def main():
	(n, d) = list(map(int, input().split(' ')))
	arr = list(map(int, input().split(' ')))
	print(solve(arr, n, d))
main()


import sys
nd = [int(x) for x in sys.stdin.readline().split()]
t = [int(x) for x in sys.stdin.readline().split()]
t.sort(reverse=True)
cnt = 0
result = 0
ind = 0
sh = 0
while ind < nd[0]:
	cnt += t[ind]
	if cnt <= nd[1]:
		ind += 1
	else:
		break
	k = 0
	while k < 10:
		cnt += 5
		k += 5
		if cnt <= nd[1]:
			sh += 1
		else:
			break
if ind != nd[0]:
	print(-1)
else:
	if cnt < nd[1]:
		sh += int((nd[1] - cnt) / 5)
	print(sh)


(n, d) = list(map(int, input().split()))
songs = list(map(int, input().split()))
time = 0
jokes = 0
overtime = False
while True:
	if len(songs) == 0:
		jokes += (d - time) // 5
		break
	s = songs.pop()
	if time + s > d:
		overtime = True
		break
	else:
		time += s
	if len(songs) > 0:
		jokes += 2
		time += 10
if overtime:
	print(-1)
else:
	print(jokes)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
if d < (len(a) - 1) * 10 + sum(a):
	print(-1)
else:
	time = 0
	count = 0
	for i in range(len(a) - 1):
		time += a[i] + 10
		count += 2
	time += a[-1]
	while time + 5 <= d:
		time += 5
		count += 1
	print(count)


(n, d) = map(int, input().split())
ts = map(int, input().split())
x = d - (sum(ts) + (n - 1) * 10)
if x >= 0:
	print(2 * (n - 1) + x // 5)
else:
	print(-1)


import sys
inp = input()
(n, d) = inp.split(' ')
(n, d) = (int(n), int(d))
inp = input()
t = [int(i) for i in inp.split(' ')]
time = sum(t) + 10 * (n - 1)
if time > d:
	print(-1)
	sys.exit()
jokes = (n - 1) * 2
jokes += int((d - time) / 5)
print(jokes)


(n, d) = map(int, input().split())
d -= sum(map(int, input().split()))
print([d // 5, -1][d + 10 < 10 * n])


(n, d) = map(int, input().split())
songs = [int(x) for x in input().split()]
if sum(songs) + (len(songs) - 1) * 10 > d:
	print(-1)
else:
	count = (len(songs) - 1) * 2
	count += (d - (sum(songs) + (len(songs) - 1) * 10)) // 5
	print(count)


(no_of_songs, max_duration) = map(int, input().split())
song_time_list = list(map(int, input().split()))
max_jokes = 0
waiting_time = (len(song_time_list) - 1) * 10
song_performance_time = 0
for song_time in song_time_list:
	song_performance_time += song_time
if waiting_time + song_performance_time > max_duration:
	print(-1)
else:
	jokes_time = max_duration - song_performance_time
	print(jokes_time // 5)


def solve():
	(n, d) = map(int, input().split())
	t = list(map(int, input().split()))
	sum = 0
	for i in range(len(t)):
		sum += t[i]
	sum += (n - 1) * 10
	if sum > d:
		print(-1)
		return
	ans = (n - 1) * 2
	ans += (d - sum) // 5
	print(ans)
solve()


(n, d) = map(int, input().split())
L = list(map(int, input().split()))
d = d - sum(L)
print([-1, d // 5][d >= 10 * (n - 1)])


(n_val, d_val) = list(map(int, input().split()))
song_duration = list(map(int, input().split()))
needed_time = (n_val - 1) * 10 + sum(song_duration)
if d_val < needed_time:
	print('-1')
else:
	jokes = (d_val - needed_time) // 5 + (n_val - 1) * 2
	print(jokes)


(n, d) = input().split()
(n, d) = (int(n), int(d))
lis = input().split()
for i in range(n):
	lis[i] = int(lis[i])
if 10 * (len(lis) - 1) + sum(lis) > d:
	print(-1)
else:
	di = d - (10 * (len(lis) - 1) + sum(lis))
	print(di // 5 + 2 * (len(lis) - 1))


import sys
input = sys.stdin.readline
from collections import deque
(n, d) = map(int, input().split())
t = list(map(int, input().split()))
summ = 0
for i in range(n):
	summ += t[i]
summ += 10 * (n - 1)
if summ > d:
	print(-1)
else:
	d = d - summ
	print(2 * (n - 1) + d // 5)


(n, d) = [int(c) for c in input().split()]
t = sum([int(c) for c in input().split()])
breaks = (n - 1) * 10
if t + breaks > d:
	print(-1)
else:
	free = d - (t + breaks)
	print(2 * (n - 1) + free // 5)


def main():
	(n, d) = map(int, input().split())
	a = list(map(int, input().split()))
	add = sum(a) + (n - 1) * 10
	if add <= d:
		jokes = d - add + (n - 1) * 10
		jokes = jokes // 5
		print(jokes)
	else:
		print(-1)
main()


(n, d) = map(int, input().split())
a = [int(x) for x in input().split()]
a.sort()
jc = 0
while d > 0:
	if len(a) > 0 and len(a) != 1:
		d -= a.pop()
		if 10 <= d:
			d -= 10
			jc += 2
		else:
			jc += d // 5
			break
	elif len(a) == 1:
		d -= a.pop()
		jc += d // 5
		break
if len(a) != 0:
	print(-1)
else:
	print(jc)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
c = []
s = 0
l = 0
for i in range(len(a)):
	s += a[i]
	c.append(s)
	s += 10
	l += 1
if c[-1] > d:
	print(-1)
else:
	print((d - c[-1]) // 5 + 2 * (l - 1))


er = list(map(int, input().split()))
sd = list(map(int, input().split()))
wd = sum(sd) + 10 * (len(sd) - 1)
if wd > er[1]:
	print(-1)
else:
	print(abs(wd - er[1]) // 5 + (len(sd) - 1) * 2)


S = input().split()
n = int(S[0])
Su = int(S[1])
k = 0
l = list(map(int, input().split()))
for i in range(n):
	Su = Su - l[i]
	if i != n - 1:
		k = k + 2
		Su = Su - 10
if Su < 0:
	print(-1)
else:
	print(k + Su // 5)


(length, time) = map(int, input().split())
lis = list(map(int, input().split()))
s = sum(lis)
if time - s < 10 * (length - 1):
	print(-1)
else:
	print((time - s) // 5)


a = [int(x) for x in input().split()]
t = [int(x) for x in input().split()]
n = a[0]
d = a[1]
s = 0
for i in range(0, n):
	s += t[i]
b = s + (n - 1) * 10
t = d - b
if b > d:
	print('-1')
else:
	print(2 * (n - 1) + int(t / 5))


(n, d) = map(int, input().split())
t = [int(e) for e in input().split()]
s = sum(t)
tot = s + (n - 1) * 10
if d < tot:
	print(-1)
else:
	print((d - s) // 5)


from sys import stdin, stdout
input = stdin.readline
(n, d) = map(int, input().split())
t = list(map(int, input().split()))
s = 0
for i in range(n):
	s += t[i] + 10
s -= 10
ans = '-1'
if s <= d:
	ans = str(int((d - s) / 5 + (n - 1) * 2))
print(ans)


(song, time) = map(int, input().split())
T = list(map(int, input().split()))
if time < (song - 1) * 10 + sum(T):
	print(-1)
elif time == (song - 1) * 10 + sum(T):
	print((song - 1) * 10 // 5)
else:
	x = (song - 1) * 10
	jokes = x // 5
	time -= x + sum(T)
	print(time // 5 + jokes)


(n, d) = list(map(int, input().split()))
for x in list(map(int, input().split())):
	d -= x
s = d - 10 * (n - 1)
if s >= 0:
	print((n - 1) * 2 + s // 5)
else:
	print(-1)


(n, d) = map(int, input().split())
so = sum(list(map(int, input().split())))
br = (d - so) // 10
if br < n - 1:
	print(-1)
else:
	jo = (d - so) // 5
	print(jo)


(b, d) = input().split()
b = int(b)
d = int(d)
a = list(map(int, input().split()))
sum = 0
for x in a:
	sum += x
if sum + (b - 1) * 10 <= d:
	print((d - sum) // 5)
else:
	print(-1)


(n, d) = map(int, input().split())
t = sum(map(int, input().split()))
t1 = d - t
if t + (n - 1) * 10 > d:
	print(-1)
else:
	print(t1 // 5)


import sys
(num_subject, time_constraint) = list(map(int, sys.stdin.readline().split()))
subject_time_list = list(map(int, sys.stdin.readline().split()))
min_time = sum(subject_time_list) + (num_subject - 1) * 10
if min_time > time_constraint:
	print(-1)
else:
	print((time_constraint - min_time) // 5 + (num_subject - 1) * 2)


R = lambda : list(map(int, input().split()))
(n, d) = R()
t = R()
tot = sum(t) + (n - 1) * 10
if tot > d:
	print(-1)
	exit(0)
tot = d - tot
ans = tot // 5
tot %= 5
ans += (n - 1) * 2
print(ans)


def joke(n, k, ls):
	s = sum(ls) + (n - 1) * 10
	if s <= k:
		h = k - sum(ls)
		return int(h / 5)
	else:
		return -1
(n, k) = input().split()
k = int(k)
n = int(n)
ls = [int(i) for i in input().split()]
print(joke(n, k, ls))


(n, d) = map(int, input().split())
s = list(map(int, input().split()))
sumt = sum(s) + 10 * (len(s) - 1)
if sumt > d:
	sol = -1
else:
	sol = (d - sum(s)) // 5
print(sol)


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
Devus_time = sum(t) + (n - 1) * 10
if Devus_time > d:
	print(-1)
else:
	Churus_time = (n - 1) * 2 + (d - Devus_time) // 5
	print(Churus_time)


def singer_and_joker(nn, mm, tt):
	s = sum(tt) + (nn - 1) * 10
	if s <= mm:
		return (mm - s) // 5 + (nn - 1) * 2
	else:
		return -1
f = lambda : map(int, input().split())
(n, m) = f()
t = list(f())
print(singer_and_joker(n, m, t))


s = list(map(int, input().split()))
ss = list(map(int, input().split()))
sm = sum(ss) + (s[0] - 1) * 10
bdsm = (s[1] - sum(ss)) // 5
if sm > s[1]:
	print('-1')
else:
	print(bdsm)


(n, m) = map(int, input().split())
data = list(map(int, input().split()))
total = sum(data)
if (n - 1) * 10 + total > m:
	print(-1)
	exit()
print((n - 1) * 10 // 5 + (m - (n - 1) * 10 - total) // 5)


(n, m) = map(int, input().split())
s = [int(i) for i in input().split()]
print('-1' if (n - 1) * 10 + sum(s) > m else (m - sum(s)) // 5)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
sum1 = sum(l)
len = len(l)
total = sum1 + 10 * (len - 1)
if d >= total:
	t = d - total
	ans = 2 * (len - 1) + t // 5
	print(ans)
else:
	print('-1')


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
jokes = 0
for (i, num) in enumerate(arr):
	if num > d:
		print(-1)
		break
	d -= num
	if d >= 5:
		d -= 5
		jokes += 1
	elif i != n - 1:
		print(-1)
		break
	if d >= 5:
		d -= 5
		jokes += 1
	elif i != n - 1:
		print(-1)
		break
else:
	print(jokes + d // 5)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
s = sum(l) + (n - 1) * 10
if s > m:
	print(-1)
else:
	print((n - 1) * 2 + (m - s) // 5)


(n, d) = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
minimum_singing = sum(t) + 10 * (n - 1)
if minimum_singing <= d:
	print((n - 1) * 2 + (d - minimum_singing) // 5)
else:
	print(-1)


import math
ins = input().strip().split(' ')
(n, d) = (int(ins[0]), int(ins[1]))
t = [int(i) for i in input().strip().split(' ')]
s = sum(t)
rest = 10 * (n - 1)
if s + rest <= d:
	rem = d - (s + rest)
	print(math.floor(rem / 5) + int(rest / 5))
else:
	print(-1)


(a, b) = input().split()
a = int(a)
b = int(b)
x = [int(x) for x in input().split()]
if sum(x) + (a - 1) * 10 <= b:
	print((b - sum(x)) // 5)
else:
	print(-1)


(n, d) = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
result = -2
time = -10
for i in t:
	time += i + 10
	result += 2
if time > d:
	print(-1)
else:
	print(result + (d - time) // 5)


def sc(d, lst):
	suma = sum(lst) + 10 * (len(lst) - 1)
	if suma > d:
		return -1
	return 2 * (len(lst) - 1) + (d - suma) // 5
(N, D) = [int(i) for i in input().split()]
b = [int(j) for j in input().split()]
print(sc(D, b))


(n, d) = map(int, input().split())
mas = list(map(int, input().split()))
rez = 0
d -= sum(mas)
d -= (n - 1) * 10
if d < 0:
	print(-1)
else:
	rez += 2 * (n - 1)
	rez += d // 5
	print(rez)


(n, t) = map(int, input().split())
a = list(map(int, input().split()))
z = t - (sum(a) + (n - 1) * 10)
if z >= 0:
	out = z // 5 + (n - 1) * 2
else:
	out = -1
print(out)


(n, d) = input().split(' ')
n = int(n)
d = int(d)
c = 0
a = input().split(' ')
for i in range(n):
	a[i] = int(a[i])
k = sum(a)
r = d - k - (n - 1) * 10
if r >= 0:
	if r >= 5:
		c = r // 5
	print((n - 1) * 2 + c)
else:
	print('-1')


def show(n, d, t):
	total_time_to_complete_songs = sum(t) + (n - 1) * 10
	if total_time_to_complete_songs > d:
		return -1
	else:
		time_for_extra_jokes = d - total_time_to_complete_songs
		number_of_extra_jokes = int(time_for_extra_jokes / 5)
		return number_of_extra_jokes + 2 * (n - 1)
(n, d) = list(map(int, input().split()))
t = list(map(int, input().split()))
print(show(n, d, t))


(n, d) = [int(i) for i in input().split()]
ans = (d - sum([int(i) for i in input().split()])) // 5
if ans >= (n - 1) * 2:
	print(ans)
else:
	print(-1)


(n, m) = map(int, input().strip().split()[:2])
k = list(map(int, input().strip().split()[:n]))
p = sum(k) + (n - 1) * 10
if p > m:
	print(-1)
else:
	print((m - sum(k)) // 5)


__author__ = 'Bian'
(n, d) = [int(x) for x in input().split()]
sing = [int(x) for x in input().split()]
if (n - 1) * 10 + sum(sing) > d:
	print(-1)
else:
	print((d - sum(sing)) // 5)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
s = sum(l)
l = (n - 1) * 10
t = s + l
if t <= d:
	diff = d - t
	ans = diff // 5
	print(ans + (n - 1) * 2)
else:
	print('-1')


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) + 2 * (n - 1) * 5 > d:
	print(-1)
else:
	print((d - sum(a)) // 5)


(n, m) = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
s = 0
d = sum(c)
e = (n - 1) * 10
d = d + e
if d > m:
	print(-1)
else:
	e = e // 10
	f = e * 2
	h = (m - d) // 5
	print(h + f)


(n, d) = map(int, input().split())
l = list(map(int, input().rstrip().rsplit()))
dur = l[-1]
a = sum(l)
l = l[:-1]
b = [x + 10 for x in l]
res = sum(b) + dur
y = d - res
if y > -1:
	x = res - a
	x = x // 5
	y = y // 5
	print(x + y)
else:
	print(-1)


import sys
(s, d) = [int(x) for x in input().split()]
SongTime = [int(y) for y in input().split()]
Jcount = 0
Total = 0
TTime = sum(SongTime) + (s - 1) * 10
if TTime > d:
	print(-1)
	sys.exit()
for z in range(s - 1):
	Total += SongTime[z] + 10
	Jcount += 2
Total += SongTime[s - 1]
if Total == d:
	print((s - 1) * 2)
	sys.exit()
elif d - Total >= 5:
	Add = (d - Total) // 5
	Jcount += Add
print(Jcount)


import math
(n, d) = map(int, input().split())
t = list(map(int, input().split()))
if sum(t) + 10 * (n - 1) <= d:
	print(int(abs((sum(t) - d) / 5)))
else:
	print(-1)


(songnum, sumtime) = map(int, input().split())
timelist = [int(h) for h in input().split()]
if sumtime < sum(timelist) + (songnum - 1) * 10:
	print(-1)
else:
	print((sumtime - sum(timelist)) // 5)


import sys
from math import *
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
from collections import defaultdict as df
import heapq
infinite = float('inf')
(n, d) = RI()
l = RI()
i = n - 1
flag = 0
c = 0
while d > 0 and i >= 0:
	if d >= l[i]:
		d -= l[i]
		i -= 1
	else:
		flag = 1
		break
	if d >= 10:
		d -= 10
		c += 2
	else:
		break
if i != -1:
	print(-1)
else:
	while d >= 5:
		d -= 5
		c += 1
	print(c)


l1 = [int(x) for x in input().split()]
l2 = [int(x) for x in input().split()]
if 10 * (len(l2) - 1) + sum(l2) > l1[1]:
	print(-1)
else:
	print(int((l1[1] - sum(l2)) / 5))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from math import sqrt, floor, factorial, gcd, log
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from math import gcd
from bisect import bisect
input = lambda : sys.stdin.readline().rstrip('\r\n')
read = lambda : list(map(int, input().strip().split(' ')))

def solve():
	(n, d) = read()
	s = sum(read())
	if d < s + 10 * (n - 1):
		print(-1)
	else:
		print((n - 1) * 2 + (d - s - 10 * (n - 1)) // 5)
solve()


(n, d) = map(int, input().split())
time = list(map(int, input().split()))
joke = 0
add = sum(time)
gap = (n - 1) * 10
if gap + add <= d:
	d = d - add
	joke = d // 5
	print(joke)
else:
	print('-1')


(n, total) = map(int, input().split())
l = list(map(int, input().split()))
t = sum(l)
if t + (n - 1) * 10 > total:
	print(-1)
else:
	print((total - t) // 5)


(n, d) = map(int, input().split())
l1 = list(map(int, input().split()))
if 10 * (n - 1) + sum(l1) > d:
	print(-1)
else:
	print((d - sum(l1)) // 5)


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
s = sum(arr)
s = s + (n - 1) * 10
if s > d:
	print('-1')
else:
	res = (n - 1) * 2
	res = res + (d - s) // 5
	print(res)


(n, d) = list(map(int, input().split()))
t = list(map(int, input().split()))
num_jokes = 2 * (n - 1)
time = 5 * num_jokes + sum(t)
if time > d:
	print(-1)
else:
	diff = d - time
	print(num_jokes + int(diff // 5))


is_debug = False
(n, d) = map(int, input().split())
t = list(map(int, input().split()))
s = sum(t) + (n - 1) * 10
print(f's={s}', end='|') if is_debug else ''
if s > d:
	print('-1')
else:
	v = d - s
	c = (n - 1) * 2 + int(v / 5)
	print(f'{c}')


(n, limit) = map(int, input().split())
lst = list(map(int, input().split()))
s = sum(lst) + (n - 1) * 10
if s > limit:
	print(-1)
else:
	print(2 * (n - 1) + (limit - s) // 5)


(n, d) = [int(string) for string in input().split()]
songs = [int(string) for string in input().split()]
songs_count = len(songs)
songs_total = sum(songs)
min_delays = 10 * (songs_count - 1)
if min_delays + songs_total > d:
	print(-1)
else:
	print((d - songs_total) // 5)


(n, d) = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
s = sum(arr)
if d - s < (n - 1) * 10:
	print(-1)
else:
	time_remaining = d - s - 10 * (n - 1)
	jokes = (n - 1) * 2
	jokes += time_remaining // 5
	print(jokes)


(n, t) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
sum1 = sum(l[:len(l) - 1])
sum1 += 10 * (n - 1) + l[n - 1]
if sum1 > t:
	print('-1')
else:
	print((t - sum1) // 5 + 10 * (len(l) - 1) // 5)


(n, d) = list(map(int, input().split(' ')))
times = list(map(int, input().split(' ')))
allTime = 0
for (index, time) in enumerate(times):
	if index != len(times) - 1:
		allTime += time + 10
	else:
		allTime += time
if allTime > d:
	print('-1')
else:
	print((len(times) - 1) * 2 + int((d - allTime) / 5))


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
charubet = 10 * (n - 1)
devu = sum(arr)
if charubet + devu > d:
	print(-1)
	exit()
ans = (d - (charubet + devu)) // 5
print(ans + 2 * (n - 1))


import time, sys
x = time.localtime().tm_sec
num1 = input()
num2 = input()
a = []
b = []

def get_the_data(count, num, arr):
	for i in range(0, len(num)):
		if num[i] == ' ':
			arr.append(int(num[count:i]))
			count = i + 1
		elif i == len(num) - 1:
			arr.append(int(num[count:len(num)]))
	return arr
arr1 = get_the_data(0, num1, a)
arr2 = get_the_data(0, num2, b)
time_limit = arr1[1]
i = 0
k = 1
jokes = 0
while time_limit > 0:
	y = time.localtime().tm_sec
	if y - x > 2:
		sys.exit()
	if k % 2 == 1 and i < arr1[0]:
		time_limit -= arr2[i]
		if time_limit >= 0:
			i += 1
	elif i < arr1[0]:
		time_limit -= 10
		jokes += 2
	elif time_limit - 5 >= 0:
		jokes += 1
		time_limit -= 5
	else:
		break
	k += 1
if i == arr1[0]:
	print(jokes)
else:
	print(-1)


st = input().split()
n = int(st[0])
d = int(st[1])
t = map(int, input().split())
time = 0
count = 0
for k in t:
	time += k
	time += 10
	count += 2
if time > d:
	time -= 10
	count -= 2
while True:
	if time + 5 > d:
		break
	else:
		time += 5
		count += 1
if time > d:
	print(-1)
else:
	print(count)


(n, d) = map(int, input().split())
song_durations = list(map(int, input().split()))
break_time_after_joke = 10
joke_duration = 5
num_jokes = 0
finished_all_songs = False
num_time_remaining = 0
for i in range(n):
	song_duration = song_durations[i]
	d -= song_duration
	if i == n - 1:
		if d >= 0:
			finished_all_songs = True
			num_jokes += d // joke_duration
		break
	if d >= break_time_after_joke:
		d -= break_time_after_joke
		num_jokes += break_time_after_joke // joke_duration
	else:
		if d >= 0:
			num_jokes += d // joke_duration
		break
o = num_jokes if finished_all_songs else -1
print(o)


I = lambda : map(int, input().split())
(n, t) = I()
t -= sum(I()) + (n - 1) * 10
print([(n - 1) * 2 + t // 5, -1][t < 0])


def singer(n, d, array):
	sing_time = sum(array)
	remain_time = d - sing_time
	if remain_time >= 0:
		jokes_time_btw = (n - 1) * 2 * 5
		if remain_time - jokes_time_btw >= 0:
			extra_jokes = (remain_time - jokes_time_btw) / 5
			total_jokes = extra_jokes + 2 * (n - 1)
			print(int(total_jokes))
		else:
			print(-1)
	else:
		print(-1)
(n, d) = input().split()
array = [int(x) for x in input().split()]
singer(int(n), int(d), array)


(n, d) = map(int, input().split())
ti = list(map(int, input().split()))
num = sum(ti) + 10 * (n - 1)
if num > d:
	print(-1)
else:
	print((n - 1) * 2 + (d - num) // 5)


def solve():
	(n, d) = map(int, input().split())
	t = list(map(int, input().split()))
	sum_t = sum(t)
	if sum_t + 10 * (n - 1) > d:
		return -1
	ans = 2 * (n - 1) + (d - sum_t - 10 * (n - 1)) // 5
	return ans
print(solve())


(n, d) = [int(x) for x in input().split()]
s = sum((int(x) for x in input().split()))
if (d - s) // 5 >= (n - 1) * 2:
	print((d - s) // 5)
else:
	print(-1)


(N, D) = map(int, input().split())
T = list(map(int, input().split()))
temp = sum(T) + 10 * (N - 1)
if temp > D:
	print(-1)
	exit()
ans = 2 * (N - 1) + (D - temp) // 5
print(ans)


x = input().split(' ')
duration = int(x[1])
y = input().split(' ')
for i in range(len(y)):
	y[i] = int(y[i])
if sum(y) + (len(y) - 1) * 10 > duration:
	print(-1)
else:
	duration -= sum(y)
	import math
	print(math.floor(duration / 5))


(n, m) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
if (n - 1) * 10 + sum(l) > m:
	print(-1)
else:
	print((m - sum(l)) // 5)


from sys import stdin as cin, stdout as cout
from math import factorial as f
from itertools import combinations as comb
(n, d) = map(int, cin.readline().split())
a = list(map(int, cin.readline().split()))
s = sum(a)
r = d - s - (n - 1) * 10
if r < 0:
	print(-1)
else:
	print(int((d - s) / 5))


(a, b) = (int(i) for i in input().split())
c = [int(i) for i in input().split()]
d = sum(c) + (a - 1) * 10
if d > b:
	print('-1')
	quit()
else:
	print((b - sum(c)) // 5)


(n, d) = list(map(int, input().split()))
t = list(map(int, input().split()))
tot = sum(t)
limit = tot + (n - 1) * 10
rest = d - limit
c = 0
if limit > d:
	print(-1)
else:
	for i in range(n - 1):
		c += 2
	c += rest // 5
	print(c)


(n, d) = input().split()
mins = input().split()
mins1 = [int(i) for i in mins]
(n, d) = (int(n), int(d))
if (n - 1) * 10 + int(sum(mins1)) > d:
	print('-1')
else:
	print(int((d - sum(mins1)) / 5))


t = input().split()
n = int(t[0])
mi = int(t[1])
t = [int(x) for x in input().split()]
t = sum(t)
if t + (n - 1) * 10 > mi:
	print(-1)
else:
	slon = (n - 1) * 2
	slon += (mi - (t + (n - 1) * 10)) // 5
	print(slon)


(n, d) = map(int, input().split())
t = sum(list(map(int, input().split())))
j = (n - 1) * 10
k = j + t
if d - k >= 0:
	print((n - 1) * 2 + (d - k) // 5)
else:
	print(-1)


import sys
I = sys.stdin.readline
(n, d) = map(int, I().split())
t = list(map(int, I().split()))
total_time = sum(t)
if total_time + (n - 1) * 10 > d:
	print(-1)
else:
	print((d - total_time) // 5)


(n, d) = input().split()
(n, d) = (int(n), int(d))
l = list(map(int, input().split()))
c = d - sum(l) - (n - 1) * 10
if c < 0:
	print(-1)
elif c >= 0:
	print((n - 1) * 2 + c // 5)


(n, d) = list(map(int, input().split()))
inp = list(map(int, input().split()))
jokes = 0
mins = 0
for i in range(n):
	mins += inp[i]
	if i < n - 1:
		mins += 10
		jokes += 2
	else:
		jokes += (d - mins) / 5
if mins > d:
	print(-1)
else:
	print(int(jokes))


import sys
(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
mins = 0
i = 0
count = 0
while mins <= d and i < n - 1:
	mins += arr[i] + 10
	count += 2
	i += 1
if i == n - 1 and mins < d:
	mins += arr[i]
	if mins > d:
		print('-1')
		sys.exit()
else:
	print('-1')
	sys.exit()
mins = d - mins
q = mins // 5
print(q + count)


import sys
(n, d) = map(int, sys.stdin.readline().split())
tlist = list(map(int, sys.stdin.readline().split()))
s = sum(tlist) + (n - 1) * 10
if s <= d:
	print(2 * (n - 1) + (d - s) // 5)
else:
	print(-1)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
if sum(l) + 10 * (n - 1) <= m:
	a = 10 * (n - 1) // 5
	c = (m - (sum(l) + 10 * (n - 1))) // 5
	print(a + c)
else:
	print('-1')


p = input().rstrip().split(' ')
q = input().rstrip().split(' ')
X = 0
Y = 0
G = 0
for i in range(0, len(q) - 1):
	X += int(q[i]) + 10
	if X <= int(p[1]):
		Y += 10
	else:
		G = 1
		break
if G == 1:
	print(-1)
else:
	X += int(q[len(q) - 1])
	if X > int(p[1]):
		print(-1)
	else:
		d = int(p[1]) - X
		Y += d
		print(Y // 5)


(n, d) = map(int, input().split())
t_list = list(map(int, input().split()))
ost = d - ((n - 1) * 10 + sum(t_list))
if ost >= 0:
	print(ost // 5 + (n - 1) * 2)
else:
	print('-1')


(n, time) = [int(x) for x in input().split()]
yongshi = 0
for i in input().split():
	yongshi += int(i)
zongyongshi = yongshi + (n - 1) * 10
if zongyongshi > time:
	print(-1)
else:
	print((time - yongshi) // 5)


s = input()
s = s.split()
n = int(s[0])
d = int(s[1])
s = input()
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])
if sum(a) + (len(a) - 1) * 10 <= d:
	print(int((d - sum(a)) / 5))
else:
	print(-1)


(n, m) = map(int, input().split())
a = 0
v = list(map(int, input().split()))
for x in v:
	a += x
s = m - ((n - 1) * 10 + a)
t = (n - 1) * 10 // 5
if 0 <= s < 5:
	print(t)
elif s != 0:
	for i in range(1, m // 5 + 1):
		s -= 5
		if 0 <= s < 5:
			print(t + i)
			quit()
	else:
		print(-1)


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
if sum(arr) + (n - 1) * 10 > m:
	print(-1)
else:
	print((n - 1) * 2 + (m - (sum(arr) + (n - 1) * 10)) // 5)


(n, time) = map(int, input().split())
a = list(map(int, input().split()))
req = sum(a) + 10 * (n - 1)
if req > time:
	print('-1')
else:
	jokes = 2 * (n - 1)
	extra = time - req
	jokes += extra // 5
	print(jokes)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
song = sum(a) + 10 * (n - 1)
if song > d:
	print(-1)
else:
	ans = 2 * (n - 1) + (d - song) // 5
	print(ans)


(n, s) = map(int, input().split())
l = list(map(int, input().split()))
a = int(0)
for i in range(n):
	a += l[i]
if s < a + (n - 1) * 10:
	print(-1)
else:
	print(int((s - a) / 5))


__author__ = 'myduomilia'
(n, t) = list(map(int, input().split()))
arr = list(map(int, input().split()))
s = sum(arr)
ans = 0
if s + (len(arr) - 1) * 10 > t:
	print(-1)
else:
	print((t - s) // 5)


(n, max) = map(int, input().split())
total = 0
number = 0
arr = input().split()
for i in range(0, n):
	total += int(arr[i])
if total + (n - 1) * 10 > max:
	print('-1')
elif (max - total - n - 1) * 10 >= 5:
	tmp = int(2 * (n - 1) + (max - total - (n - 1) * 10) / 5)
	print(tmp)
else:
	tmp = int(2 * (n - 1))
	print(tmp)


np = input().split()
n = int(np[0])
time = int(np[1])
song = input().split()
tsong = 0
for i in song:
	tsong += int(i)
if tsong + 10 * (n - 1) > time:
	print(-1)
else:
	print(int((time - tsong - 10 * (n - 1)) / 5) + 2 * (n - 1))


(n, d) = map(int, input().split())
t = [int(i) for i in input().split()]
m = d - (n - 1) * 10 - sum(t)
print([2 * n - 2 + m // 5, -1][m < 0])


s = input().split()
songs = int(s[0])
time = int(s[1])
l = input().split()
mat = []
cont = -2
coma = -10
for i in range(songs):
	coma += 10 + int(l[i])
	cont += 2
time -= coma
if time >= 0:
	while True:
		time -= 5
		if time >= 0:
			cont += 1
		else:
			break
	print(cont)
else:
	print(-1)


(n, d) = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
if 10 * (n - 1) + sum(A) > d:
	print(-1)
else:
	total = d - 10 * (n - 1) - sum(A)
	print(2 * (n - 1) + total // 5)


(n, d) = input().split()
n = int(n)
d = int(d)
s = 0
l = input().split()
for i in range(n):
	l[i] = int(l[i])
	s += l[i]
if s + (n - 1) * 10 <= d:
	d = d - (s + (n - 1) * 10)
	k = 2 * (n - 1)
	while d >= 5:
		d -= 5
		k += 1
	print(k)
else:
	print(-1)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res) % MOD

def comb(n, x):
	(a, b) = (1, 1)
	for i in range(1, x + 1):
		a *= n + 1 - i
		b *= i
	return a // b % MOD

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	if y == 0:
		return 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
small = 'abcdefghijklmnopqrstuvwxyz'
large = small.upper()
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt
from decimal import Decimal

def interact(x, y):
	print('?', x + 1, y + 1)
	space = input()
	sys.stdout.flush()
	return int(input())

def solve():
	(n, d) = read()
	a = get_list()
	if d - sum(a) - 10 * (n - 1) < 0:
		print(-1)
		return
	d -= sum(a)
	print(d // 5)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = 1
for i in range(t):
	solve()


(n, d) = map(int, input().split())
songs = map(int, input().split())
time_used = sum(songs) + (n - 1) * 10
if time_used > d:
	print(-1)
else:
	print((d - time_used) // 5 + 2 * (n - 1))


(n, d) = tuple(map(int, input().split()))
arr = list(map(int, input().split()))
result = 0
s = sum(arr)
if s + (n - 1) * 10 > d:
	print(-1)
else:
	print((d - s) // 5)


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
total = 0
for i in range(n):
	total += arr[i]
rem = d - total
if rem < (n - 1) * 10:
	print(-1)
else:
	print(rem // 5)


(n, d) = map(int, input().split())
songs = list(map(int, input().split()))
sparetime = d - (n - 1) * 10 - sum(songs)
if sparetime < 0:
	print(-1)
else:
	print((n - 1) * 2 + sparetime // 5)


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
int1 = lambda x: int(x) - 1
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
ilelec = lambda : map(int1, input().split())
alelec = lambda : list(map(int1, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
(n, d) = ilele()
A = alele()
if sum(A) + (n - 1) * 10 > d:
	print(-1)
else:
	c = 0
	while A:
		x = A.pop()
		d -= x
		c += min(d // 5, 2)
		d -= 10
	if d > 0:
		c += d // 5
	print(c)


d = int(input().split(' ')[1])
array2 = input().split(' ')
ts = []
for i in range(len(array2)):
	ts.append(int(array2[i]))
time = 0
jokes = 0
for i in range(len(array2)):
	if i != len(array2) - 1:
		time += ts[i] + 10
		jokes += 2
	else:
		time += ts[i]
	if time > d:
		print(-1)
		exit()
jokes += (d - time) // 5
print(jokes)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
sm = sum(a)
cal = (d - sm) // 5
fact = (n - 1) * 2
if cal >= fact:
	print(cal)
else:
	print(-1)


l = input().split()
(n, d) = (int(l[0]), int(l[1]))
a = input().split()
s = 0
for i in a:
	s += int(i)
if s + (n - 1) * 10 > d:
	print('-1')
else:
	print((d - s) // 5)


x = input()
y = input()
x = x.split(' ')
y = y.split(' ')
f = len(y) - 1
totalRest = f * 10
songsTime = 0
totalJokes = 0
for i in y:
	songsTime = songsTime + int(i)
if totalRest + songsTime > int(x[1]):
	print(-1)
else:
	totalJokes = int(totalRest / 5)
	totalJokes = totalJokes + int((int(x[1]) - (totalRest + songsTime)) / 5)
	print(totalJokes)


from sys import exit
info = input().split()
n = int(info[0])
d = int(info[1])
songs = input().split()
sum = 0
for i in range(n):
	songs[i] = int(songs[i])
	sum += songs[i]
if sum + 10 * (n - 1) > d:
	print(-1)
else:
	jokenum = (d - sum) / 5
	print(int(jokenum))


(n, d) = list(map(int, input().split()))
ti = list(map(int, input().split()))
totalTime = sum(ti) + (n - 1) * 10
if totalTime > d:
	print('-1')
else:
	d -= totalTime
	var = (n - 1) * 2 + d // 5
	print(var)


string = input()
numbers = string.split(' ')
songs = int(numbers[0])
time = int(numbers[1])
string = input()
numbers = string.split(' ')
for x in range(songs):
	numbers[x] = int(numbers[x])
minimum = sum(numbers) + (songs - 1) * 10
if minimum > time:
	jokes = -1
else:
	jokes = int((time - minimum) / 5) + (songs - 1) * 2
print(jokes)


def main():
	(n, d) = map(int, input().split(' '))
	t = sorted(list(map(int, input().split(' '))))
	s = sum(t)
	if 10 * (n - 1) >= d:
		return -1
	time = 0
	jokes = 0
	for (i, ti) in enumerate(t):
		time += ti
		if time + 10 <= d:
			time += 10
			jokes += 2
		elif time + 5 <= d:
			time += 5
			jokes += 1
		elif i != n - 1:
			time += 10
	if time > d:
		return -1
	return jokes + (d - time) // 5
print(main())


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
song = sum(t)
brk = (n - 1) * 10
if song + brk > d:
	print('-1')
	exit()
brk += d - brk - song
print(brk // 5)


def num_jokes(num_songs, song_durs, max_time):
	JOKE_DUR = 5
	REST_TIME = 10
	dur = sum([i + REST_TIME for i in song_durs]) - REST_TIME
	if max_time < dur:
		return -1
	else:
		num_jokes = REST_TIME // JOKE_DUR * (num_songs - 1)
		num_jokes += (max_time - dur) // JOKE_DUR
	return num_jokes
(num_songs, max_time) = list(map(int, input().split()))
song_durs = list(map(int, input().split()))
ret = num_jokes(num_songs, song_durs, max_time)
print(ret)


b = [int(i) for i in input().split(' ')]
n = b[0]
t = b[1]
s = 0
a = [int(n) for n in input().split(' ')]
for i in range(len(a)):
	s = s + a[i]
s = s + 10 * (len(a) - 1)
if s > t:
	print(-1)
elif s == t:
	print((len(a) - 1) * 2)
else:
	m = (t - s) // 5
	print((len(a) - 1) * 2 + m)


import functools
(n, l) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
result = functools.reduce(lambda r, x: r + x, a, 0) + (n - 1) * 10
if result > l:
	result = -1
else:
	diff = l - result
	result = (n - 1) * 2
	if diff != 0:
		result += diff / 5
print(int(result))


(n, d) = map(int, input().split())
lst = [int(i) for i in input().split()]
event_dur = 0
jokes = 0
for i in range(n - 1):
	event_dur = event_dur + lst[i] + 10
	jokes = jokes + 2
event_dur = event_dur + lst[n - 1]
if d >= event_dur:
	if d - event_dur >= 5:
		jokes = jokes + (d - event_dur) // 5
		print(jokes)
	else:
		print(jokes)
else:
	print(-1)


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
dev_t = sum(t) + 10 * (n - 1)
if dev_t > d:
	print(-1)
elif dev_t >= d and n == 1:
	print(0)
else:
	print((n - 1) * 2 + 1 + (d - dev_t - 5) // 5)


x = [int(item) for item in input().split()]
y = [int(item) for item in input().split()]
a = x[0]
if (a - 1) * 10 + sum(y) > x[1]:
	result = -1
else:
	result = int((x[1] - (a - 1) * 10 - sum(y)) / 5) + (a - 1) * 2
print(result)


def intmaker(arr):
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	return arr
(n, d) = intmaker(input().split())
songs = intmaker(input().split())
for i in range(n):
	d -= songs[i]
if d < (n - 1) * 10:
	print(-1)
else:
	print(int(d / 5))


(n, d) = str(input()).split()
n = int(n)
d = int(d)
line = str(input()).split()
line = [int(it) for it in line]
s = (n - 1) * 10 + sum(line)
if d < s:
	print(-1)
else:
	print((n - 1) * 2 + int((d - s) / 5))


(m, n) = map(int, input().split())
arr = list(map(int, input().split()))
arrsum = sum(arr)
time_taken = arrsum + (m - 1) * 10
if time_taken > n:
	print(-1)
else:
	print((n - arrsum) // 5)


(n, d) = map(int, input().split())
songs = list(map(int, input().split()))
time = 0
anecdots = 0
for index in range(n):
	song = songs[index]
	time += song
	if index != n - 1:
		time += 10
		anecdots += 2
if d - time > 0:
	print(anecdots + (d - time) // 5)
elif d == time:
	print(anecdots)
else:
	print(-1)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
su = 0
for f in range(n):
	su += l[f]
	if f == n - 1:
		break
	su += 10
if su > d:
	print(-1)
else:
	print((n - 1) * 2 + (d - su) // 5)


def parse(st):
	return [int(x) for x in st.split()]

def solve(n, d, l):
	joke = (n - 1) * 10
	sing = sum(l)
	needed = joke + sing
	if needed > d:
		return -1
	ans = (d - sing) / 5
	return int(ans)
(n, d) = parse(input())
l = parse(input())
print(solve(n, d, l))


stri = input().split()
n = int(stri[0])
d = int(stri[1])
times = []
stri = input().split()
for i in range(n):
	times.append(int(stri[i]))
summation = sum(times)
if summation + (n - 1) * 10 <= d:
	count = (n - 1) * 2
	d -= summation + (n - 1) * 10
	count += d // 5
	print(count)
else:
	print('-1')


(n, concert_time) = input().split()
n = int(n)
concert_time = int(concert_time)
songs_time = input().split()
num_of_jokes = 0
for song in range(n - 1):
	concert_time -= int(songs_time[song]) + 10
	num_of_jokes += 2
if concert_time - int(songs_time[-1]) >= 0:
	concert_time -= int(songs_time[-1])
	print(num_of_jokes + concert_time // 5)
else:
	print(-1)


(n, d) = map(int, input().split())
songs = list(map(int, input().split()))
if (d - sum(songs)) % 5 >= 0 and d - sum(songs) >= (n - 1) * 10:
	print((d - sum(songs)) // 5)
else:
	print(-1)


s = [int(n) for n in input().split()]
a = [int(n) for n in input().split()]
x = sum(a) + (s[0] - 1) * 10
if x > s[1]:
	print(-1)
else:
	print((s[1] - sum(a)) // 5)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
least_time = (n - 1) * 10 + sum(a)
if least_time > d:
	print(-1)
else:
	jokes = (n - 1) * 2
	jokes += (d - least_time) // 5
	print(jokes)


(n, m) = map(int, input().split())
c = list(map(int, input().split()))
k = c[0]
l = 0
for i in range(1, n):
	l += 2
	k += 10 + c[i]
if m < k:
	print(-1)
else:
	print(l + (m - k) // 5)


(n, d) = map(int, input().split())
inp = sum(list(map(int, input().split())))
if inp > d or inp + (n - 1) * 10 > d:
	print(-1)
else:
	z = d - inp
	print(int(z / 5))


from math import floor
from typing import List, Tuple

def parse_input() -> Tuple[int, int, List[int]]:
	(n, d) = [int(x) for x in input().split()]
	return (n, d, [int(x) for x in input().split()])

def solve(n: int, d: int, t: List[int]) -> int:
	time = (n - 1) * 10 + sum(t)
	if time > d:
		return -1
	if time == d:
		return (n - 1) * 2
	return (n - 1) * 2 + floor((d - time) / 5)
(n, d, t) = parse_input()
print(solve(n, d, t))


a = list(map(int, input().split()))
n = int(a[0])
d = int(a[1])
l = [0] * n
l = list(map(int, input().split()))
t = 0
b = 0
for i in range(n):
	t = t + l[i]
if t + (n - 1) * 10 > d:
	print(-1)
else:
	b = (d - t) / 5
	print(int(b))


def devu_singer_charu_joker():
	(songs, duration) = [int(x) for x in input().split(' ')]
	song_durations = [int(x) + 10 for x in input().split(' ')]
	song_durations[-1] = song_durations[-1] - 10
	no_ok_jokes_on_break = (songs - 1) * 2
	sum_of_song_duration = sum(song_durations)
	if sum_of_song_duration > duration:
		return -1
	else:
		return no_ok_jokes_on_break + (duration - sum_of_song_duration) // 5
print(devu_singer_charu_joker())


(n, d) = map(int, input().split())
t_list = list(map(int, input().split()))
total_singing_time = sum(t_list) + 10 * (len(t_list) - 1)
if d < total_singing_time:
	print(-1)
	exit()
else:
	remaining_churu_time = d - total_singing_time
	additional_jokes = remaining_churu_time // 5
	total_jokes = 2 * (len(t_list) - 1) + additional_jokes
	print(total_jokes)


(n, d) = map(int, input().split())
L = list(map(int, input().split()))
r = 0
t = sum(L) + (n - 1) * 10
if t > d:
	print(-1)
else:
	print(2 * (n - 1) + (d - t) // 5)


(n, t) = map(int, input().split())
l = list(map(int, input().split()))
churu = (n - 1) * 10
sm = sum(l)
if t < sm + churu:
	print(-1)
else:
	print((t - sm) // 5)


(n, d) = map(int, input().split())
t = [int(z) for z in input().split()]
if (n - 1) * 10 + sum(t) > d:
	print(-1)
else:
	print((d - sum(t)) // 5)


(n, d) = input().split()
n = int(n)
d = int(d)
arr = input()
l = list(map(int, arr.split(' ')))
s = 0
for i in range(0, n):
	s = s + l[i]
s = s + (n - 1) * 10
if s > d:
	print(-1)
else:
	ans = (n - 1) * 2 + (d - s) // 5
	print(ans)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
s = sum(l)
res = (n - 1) * 10 + s
if res > d:
	print(-1)
else:
	if d - res >= 5:
		r = 5
		c = 1
	else:
		r = 0
		c = 0
	for i in l[:-1]:
		r += i
		r += 10
		c += 2
	r += l[-1]
	left = d - r
	print(c + left // 5)


time = int(input().split()[1])
songs_time = [int(x) for x in input().split()]
if sum(songs_time) + (len(songs_time) - 1) * 10 > time:
	print('-1')
else:
	jokes = (time - sum(songs_time)) // 5
	print(jokes)


line = [int(a) for a in input().split()]
n = line[0]
d = line[1]
s = [int(b) for b in input().split()]
ss = sum(s) + 10 * (n - 1)
cnt = 2 * (n - 1)
if ss > d:
	print(-1)
else:
	dif = d - ss
	ex = dif // 5
	cnt = cnt + ex
	print(cnt)


from sys import stdin, stdout, stderr, setrecursionlimit
setrecursionlimit(100000)

def debug(*e):
	if not __debug__:
		print(*e, file=stderr)

def dd(*vals):
	import inspect, re
	frame = inspect.getframeinfo(inspect.stack()[1][0])
	vs = re.search('dd\\((.+)\\)', frame.code_context[0]).group(1).split(',')
	if vs:
		debug(','.join(('{0} = {1}'.format(vs[i], v) for (i, v) in enumerate(vals))))

def trace(f):

	def traced(*args, **kw):
		debug('calling {} with args {}, {}'.format(f.__name__, args, kw))
		return f(*args, **kw)
	return traced

def read():
	return stdin.readline().rstrip()

def readarr(sep=None, maxsplit=-1):
	return read().split(sep, maxsplit)

def readint():
	return int(read())

def readia(sep=None, maxsplit=-1):
	return [int(a) for a in readarr(sep, maxsplit)]

def write(*args, **kwargs):
	sep = kwargs.get('sep', ' ')
	end = kwargs.get('end', '\n')
	stdout.write(sep.join((str(a) for a in args)) + end)

def writea(arr, sep=' ', end='\n'):
	stdout.write(sep.join((str(a) for a in arr)) + end)
(n, d) = readia()
ss = readia()
t = 0
c = 0
for x in ss:
	t += x
	if t > d:
		write(-1)
		break
	if d - t >= 5:
		c += 1
		t += 5
	else:
		t = d
	if d - t >= 5:
		c += 1
		t += 5
	else:
		t = d
else:
	write(c + (d - t) // 5)


a = list(map(int, input().split()))
(n, d) = (a[0], a[1])
b = list(map(int, input().split()))
s = 0
for i in b:
	s += i
s1 = s + 10 * (n - 1)
if d < s1:
	print(-1)
else:
	print((d - s1) // 5 + 2 * (n - 1))


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
cnt = 0
i = 0
j = 0
if n == 1:
	cnt = (d - arr[0]) // 5
	print(cnt)
	exit(0)
while i < d:
	i += arr[j]
	if j < n - 1:
		i += 10
		j += 1
		cnt += 2
	if j == n - 1 and d - i >= arr[j]:
		i += arr[j]
		j += 1
		break
	if d - i < 10:
		break
cnt += (d - i) // 5
if j <= n - 1:
	print(-1)
else:
	print(cnt)


(a, b) = map(int, input().split())
z = list(map(int, input().split()))
q = b - sum(z) - (a - 1) * 10
if q < 0:
	print(-1)
else:
	print((a - 1) * 2 + q // 5)


(n, d) = map(int, input().split())
lst = [int(i) for i in input().split()]
if (n - 1) * 10 + sum(lst) > d:
	print('-1')
else:
	a = d - ((n - 1) * 10 + sum(lst))
	b = (n - 1) * 2 + int(a / 5)
	print(b)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
ss = sum(l)
s = sum(l) + (n - 1) * 10
if s > d:
	print(-1)
else:
	x = d - ss
	print(x // 5)


(n, d) = input().split()
(n, d) = (int(n), int(d))
A = input()
B = []
for i in A.split():
	B.append(int(i))
if sum(B) + 10 * (n - 1) > d:
	print(-1)
else:
	Sum = int((d - sum(B) - 10 * (n - 1)) / 5) + (n - 1) * 2
	print(Sum)


sa = input().split(' ')
songs = int(sa[0])
mins = int(sa[1])
sa2 = input().split(' ')
sa3 = []
for item in sa2:
	sa3.append(int(item))
sums = 0
for item in sa3:
	sums += item
if (songs - 1) * 10 + sums > mins:
	print(-1)
else:
	print((mins - sums) // 5)


def rest(d, count):
	d -= 10
	count += 2
	return (d, count)
(n, d) = map(int, input().split())
count = 0
tt = [int(x) for x in input().split()]
for song in range(len(tt)):
	if song == n - 1:
		d -= tt[song]
		count += int(d / 5)
	else:
		d -= tt[song]
		(d, count) = rest(d, count)
	if d < 0:
		count = -1
		break
print(count)


(n, d) = map(int, input().split())
data = [int(i) for i in input().split()]
if sum(data) + 10 * (len(data) - 1) > d:
	print(-1)
else:
	print((d - sum(data)) // 5)


(n, d) = list(map(int, input().split()))
t = list(map(int, input().split()))
op1 = sum(t) + 10 * (n - 1)
if d >= op1:
	ans = 2 * (n - 1) + (d - op1) // 5
else:
	ans = -1
print(ans)


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)
from math import ceil, floor, log, sqrt, factorial

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, d) = get_ints()
Arr = get_array()
total = sum(Arr) + (n - 1) * 10
if total > d:
	print(-1)
	exit()
print(2 * (n - 1) + (d - total) // 5)


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
sum = 0
for ti in t:
	sum += ti
if sum + (n - 1) * 10 <= d:
	print((d - sum) // 5)
else:
	print(-1)


(n, d) = list(map(int, input().split()))
a = list(map(int, input().split()))
res = 0
t = 0
for i in a[:-1]:
	t += i + 10
	res += 2
t += a[-1]
if t > d:
	res = -1
else:
	res += (d - t) // 5
print(res)


(n, b) = map(int, input().split())
l = list(map(int, input().split()))
joke = 0
time = 0
for i in l:
	time += i
	time += 10
	joke += 2
time -= 10
joke -= 2
if time > b:
	print(-1)
else:
	b -= time
	b //= 5
	joke += b
	print(joke)


test = input().split()
test = list(map(int, test))
arr = input().split()
arr = list(map(int, arr))
su = 0
count = (len(arr) - 1) * 2
for i in range(test[0]):
	su = su + arr[i]
su = su + 10 * (len(arr) - 1)
if su > test[1]:
	print(-1)
else:
	test[1] = test[1] - su
	count = count + int(test[1] / 5)
	print(count)


a = input().split()
nos = int(a[0])
tot = int(a[1])
l = []
b = input().split()
for i in range(nos):
	l.append(int(b[i]))
p = sum(l)
m = p + (nos - 1) * 10
if m > tot:
	print(-1)
else:
	n = (tot - p) // 5
	print(n)


(n, t) = list(map(int, input().split()))
s = list(map(int, input().split()))
if sum(s) + (len(s) - 1) * 10 > t:
	print(-1)
else:
	print((len(s) - 1) * 2 + (t - sum(s) - (len(s) - 1) * 10) // 5)


def main():
	(n, d) = list(map(int, input().split()))
	t = list(map(int, input().split()))
	total = sum(t)
	r = d - total - (n - 1) * 10
	if r < 0:
		print(-1)
	else:
		print(int((n - 1) * 2 + r / 5))
	return
main()


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
tot = sum(arr)
tottime = tot + (n - 1) * 10
if d < tottime:
	print(-1)
else:
	print((d - tot) // 5)


import math
contents = []
total = 0
counter = 0
while True:
	try:
		contents.append(input().split())
	except:
		break
num_songs = int(contents[0][0])
duration = int(contents[0][1])
diff = duration - ((int(contents[0][0]) - 1) * 10 + sum((int(item) for item in contents[1])))
if diff >= 0:
	jokes = math.floor(diff / 5) + (int(contents[0][0]) - 1) * 2
else:
	jokes = -1
print(jokes)


(n, d) = (int(x) for x in input().split())
sum_t = 0
for i in input().split():
	sum_t += int(i)
sum_t += (n - 1) * 10
if d < sum_t:
	print(-1)
else:
	print((d - sum_t + (n - 1) * 10) // 5)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
k = d - sum(l)
if n == 1 and d == 1 and (sum(l) == 1):
	print('0')
elif n - 1 <= int(k / 10) and k > 0:
	f = k % 10
	if f > 4:
		f = 1 + int(k / 10) * 2
	else:
		f = int(k / 10) * 2
	print(f)
else:
	print('-1')


(n, d) = map(int, input().split())
songsT = list(map(int, input().split()))
jokes = 0
if sum(songsT) + (len(songsT) - 1) * 10 > d:
	print(-1)
else:
	print((d - sum(songsT)) // 5)


(n, d) = [int(i) for i in input().split()]
ls = [int(i) for i in input().split()]
count = 10 * (len(ls) - 1)
for i in ls:
	count += i
if count > d:
	print('-1')
else:
	jokes = (len(ls) - 1) * 2 + (d - count) // 5
	print(jokes)


(n, d) = map(int, input().split())
songs = [int(i) for i in input().split()]
if sum(songs) + 10 * (n - 1) > d:
	print(-1)
else:
	print(2 * (n - 1) + (d - sum(songs) - (n - 1) * 10) // 5)


n = list(map(int, input().split(' ')))
t = list(map(int, input().split(' ')))
(need, ans) = (0, 0)
for f in t:
	need += f + 10
	ans += 2
need -= 10
ans -= 2
if need > n[1]:
	print('-1')
else:
	print(ans + (n[1] - need) // 5)


a = input().split()
jokeNum = int(a[0])
duration = int(a[1])
strList = input().split()
jokeList = [int(x) for x in strList]
if sum(jokeList) + (jokeNum - 1) * 10 > duration:
	print(-1)
else:
	print(int((duration - sum(jokeList)) / 5))


N = input().split(' ')
n = int(N[0])
d = int(N[1])
t = input().split(' ')
need = 0
ans = 0
for f in t:
	need = need + int(f) + 10
	ans += 2
need = need - 10
ans = ans - 2
if need > d:
	print('-1')
else:
	print(int(ans + (d - need) / 5))


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
total_time = (n - 1) * 10 + sum(t)
if total_time > d:
	print(-1)
else:
	c_jokes = (n - 1) * 2
	c_jokes += (d - total_time) // 5
	print(c_jokes)


import math
(n, d) = input().split()
n = int(n)
d = int(d)
a = [int(x) for x in input().split()]
sum1 = int(math.fsum(a))
if (len(a) - 1) * 10 + sum1 > d:
	print('-1')
else:
	print((len(a) - 1) * 10 // 5 + (d - (len(a) - 1) * 10 - sum1) // 5)


(n, d) = [int(x) for x in input().split()]
A = [int(i) for i in input().split()]
total = (n - 1) * 10
totalAux = total
for c in range(n):
	total += A[c]
if total > d:
	print(-1)
else:
	res = d - total
	totalAux += res
	print(totalAux // 5)


(n, d) = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
suml = sum(l)
if d < suml + 10 * (n - 1):
	print(-1)
else:
	count = 2 * (n - 1)
	d -= suml + 10 * (n - 1)
	if d == 0:
		print(count)
	else:
		print(count + d // 5)


(n, m) = [int(i) for i in input().split()]
a = sum([int(i) for i in input().split()]) + (n - 1) * 10
if a > m:
	print(-1)
else:
	print((n - 1) * 2 + (m - a) // 5)


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
if (n - 1) * 10 + sum(arr) > d:
	print(-1)
else:
	jokes = (n - 1) * 2
	total_time = (n - 1) * 10 + sum(arr)
	d -= total_time
	jokes += d // 5
	print(jokes)


(n, d) = map(int, input().split())
list1 = []
jok = []
t = list(map(int, input().split()))
time = 0
jokes = 0
for i in range(len(t)):
	if d - t[i] >= 0 and len(jok) == len(list1):
		d = d - t[i]
		list1.append(0)
	else:
		i -= 1
		break
	if d - 10 > 0:
		d -= 10
		jokes += 2
		jok.append(0)
	elif d % 5 == 0:
		k = d // 5
		jokes += k
		d -= 5 * k
if len(list1) != len(t) or i != len(t) - 1:
	print(-1)
elif d > 0:
	print(jokes + d // 5)
else:
	print(jokes)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
temp = sum(l) + (len(l) - 1) * 10
if temp > d:
	print(-1)
else:
	print((len(l) - 1) * 2 + (d - temp) // 5)


s = str(input()).split()
t = str(input()).split()
n = int(s[0])
d = int(s[1])
x = 0
for i in range(n):
	x += int(t[i])
c = (d - x) // 5
x += 10 * (n - 1)
if x > d:
	print(-1)
else:
	print(c)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
if 10 * (len(a) - 1) >= d or sum(a) > d or sum(a) + 10 * (len(a) - 1) > d:
	print(-1)
else:
	print(int((d - sum(a)) / 5))


(n, d) = map(int, input().split())
t = [int(x) for x in input().split()]
rem_time = d - sum(t)
if n == 1:
	if rem_time >= 0:
		print(int(rem_time / 5))
	else:
		print('-1')
elif rem_time / (len(t) - 1) >= 10:
	print(int(rem_time / 5))
else:
	print('-1')


(m, n) = map(int, input().split())
d = [int(x) for x in input().split()]
f = n - sum(d)
if (m - 1) * 10 + sum(d) > n:
	print('-1')
else:
	print(f // 5)


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))

def input():
	return stdin.readline().strip()

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (fast, lambda : map(int, z().split()))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer, end='\n'):
	stdout.write(str(answer) + end)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
(n, m) = zzz()
arr = zzz()
s = sum(arr)
if s + (n - 1) * 10 > m:
	print(-1)
	exit()
need = m - (s + (n - 1) * 10)
print(need // 5 + 2 * (n - 1))


X = list(map(int, input().split()))
Songs = list(map(int, input().split()))
ALlSongsTime = sum(Songs) + (X[0] - 1) * 10
print(-1 if ALlSongsTime > X[1] else (X[0] - 1) * 2 + (X[1] - ALlSongsTime) // 5)


(n, d) = map(int, input().split(' '))
a = 0
for k in input().split(' '):
	a += int(k)
if a + 10 * (n - 1) <= d:
	print((d - a) // 5)
else:
	print(-1)


z = list(map(int, input().split()))
y = list(map(int, input().split()))
if z[1] < sum(y) + (z[0] - 1) * 10:
	print(-1)
else:
	print((z[1] - sum(y)) // 5)


def main():
	(n, d) = map(int, input().split())
	t = list(map(int, input().split()))
	total = (n - 1) * 10 + sum(t)
	if total > d:
		print('-1')
		return
	ans = (n - 1) * 2 + (d - total) // 5
	print(ans)
main()


import sys
import math
texto = sys.stdin.read().split('\n')
texto.pop(-1)
(n, d) = texto[0].split(' ')
n = int(n)
d = int(d)
duraciones = [int(x) for x in texto[1].split(' ')]
total = (len(duraciones) - 1) * 10 + sum(duraciones)
if total > d:
	print(-1)
else:
	print((len(duraciones) - 1) * 2 + math.floor((d - total) / 5))


(n, d) = map(int, input().split())
m = list(map(int, input().split()))
ost = d - sum(m) - 10 * (n - 1)
if ost < 0:
	print(-1)
	exit()
print(ost // 5 + (n - 1) * 2)


w = input().split(' ')
n = int(w[0])
dur = int(w[1])
w2 = input().split(' ')
arr = []
for i in range(n):
	arr.append(int(w2[i]))
devu = sum(arr)
if dur < (n - 1) * 10 + devu:
	print('-1')
else:
	k = (dur - devu) / 5
	m = (dur - devu) // 5
	print(m)


(n, d) = list(map(int, input().split()))
arr = list(map(int, input().split()))
s = sum(arr)
total = s + (n - 1) * 10
if total <= d:
	print((d - s) // 5)
else:
	print(-1)


l1 = input().split(' ')
l2 = input().split(' ')
l1[0] = int(l1[0])
l1[1] = int(l1[1])
total = (l1[0] - 1) * 10
sing = 0
for i in range(l1[0]):
	l2[i] = int(l2[i])
	sing += l2[i]
if total + sing > l1[1]:
	print('-1')
else:
	print((l1[1] - sing) // 5)


(n, d) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
s = 0
for i in range(n):
	s += a[i]
x = s + (n - 1) * 10
if d < x:
	print('-1')
else:
	l = d - x
	m = l / 5
	print(int(2 * (n - 1) + m))


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
(n, d) = map(int, input().split())
t = [int(x) for x in input().split()]
churu = d - sum(t)
if n == 1:
	if churu >= 0:
		print(churu // 5)
		exit(0)
	else:
		print(-1)
		exit(0)
if churu <= 0:
	print(-1)
	exit(0)
if churu // 5 < 2 * (n - 1):
	print(-1)
	exit(0)
print(churu // 5)


(n, d) = map(int, input().split())
l = map(int, input().split())
s = sum(l)
gap = (n - 1) * 10
req_time = gap + s
if req_time <= d:
	print((d - s) // 5)
else:
	print(-1)


[n, d] = [int(x) for x in input().split(' ')]
ldds = [int(x) for x in input().split(' ')]
s = sum(ldds)
if s + (len(ldds) - 1) * 10 > d:
	print('-1')
else:
	ncj = (d - s) // 5
	print(ncj)


import math
nd = input().split(' ')
n = int(nd[0])
d = int(nd[1])
songs = list(map(int, input().split(' ')))
total_songs = len(songs)
rest_time = (total_songs - 1) * 10
if rest_time >= d:
	print(-1)
else:
	song_time = 0
	for i in songs:
		song_time += i
	time_left = d - (song_time + rest_time)
	if time_left < 0:
		print(-1)
	else:
		joke_number = rest_time // 5
		joke_number += math.floor(time_left / 5)
		print(joke_number)


try:
	(n, d) = map(int, input().split())
	t = list(map(int, input().split()))
	ts = sum(t) + (len(t) - 1) * 10
	if ts > d:
		print(-1)
	else:
		x = d - sum(t)
		print(x // 5)
except:
	pass


(n, d) = map(int, input().split())
time = list(map(int, input().split()))
t = sum(time)
min_t = (n - 1) * 10 + t
joke_ext = (d - min_t) // 5
tot_jok = joke_ext + (n - 1) * 2
if min_t > d:
	print(-1)
else:
	print(tot_jok)


import math

def solve():
	(n, d) = map(int, input().split())
	a = list(map(int, input().split()))
	if sum(a) + (n - 1) * 10 > d:
		return -1
	return (d - sum(a)) // 5
print(solve())


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
sum = 0
for i in range(len(t)):
	sum += t[i]
if (d - sum) // 5 < (n - 1) * 2:
	print(-1)
else:
	print((d - sum) // 5)


tiempo = 0
ind_can = 0
lineas = 2
text = []
num_chi = 0
for i in range(lineas):
	line = input()
	text.append(line)
text[0] = list(map(int, text[0].split()))
text[1] = list(map(int, text[1].split()))
while tiempo <= text[0][1]:
	if ind_can < text[0][0] and tiempo + text[1][ind_can] <= text[0][1]:
		tiempo += text[1][ind_can]
		ind_can += 1
	if tiempo <= text[0][1] and ind_can == text[0][0] and (tiempo + 5 > text[0][1]):
		print(num_chi)
		break
	tiempo += 5
	num_chi += 1
	if tiempo <= text[0][1] and ind_can == text[0][0] and (tiempo + 5 > text[0][1]):
		print(num_chi)
		break
	tiempo += 5
	num_chi += 1
	if tiempo <= text[0][1] and ind_can == text[0][0] and (tiempo + 5 > text[0][1]):
		print(num_chi)
		break
	if tiempo >= text[0][1] and ind_can < text[0][0]:
		print(-1)
		break


def fun(n, d, li):
	s = sum(li)
	sn = 10 * (n - 1)
	if s + sn <= d:
		ans = (n - 1) * 2
		t = (d - s - sn) // 5
		print(ans + t)
		return
	else:
		print(-1)
		return
(n, d) = list(map(lambda x: int(x), input().split()))
li = list(map(lambda x: int(x), input().split()))
fun(n, d, li)


a = list(map(int, input().split()))
b = list(map(int, input().split()))
e = 0
c = a[1] - (a[0] - 1) * 10 - sum(b)
if c < 0:
	print(-1)
else:
	d = int(c / 5)
	e = (a[0] - 1) * 2 + d
	print(e)


(n, k) = tuple(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
ans = 0
b = False
for x in a:
	if k < x:
		print(-1)
		b = True
		break
	else:
		if k - x - 10 >= -5 and k - x - 10 < 0:
			ans += 1
		elif k >= 10:
			ans += 2
		k = k - x - 10
if k >= 5:
	ans += k // 5
if not b:
	print(ans)


(n, d) = map(int, input().split())
array = list(map(int, input().split()))
if (n - 1) * 10 + sum(array) > d:
	print('-1')
else:
	e = d - (n - 1) * 10 - sum(array)
	f = e // 5
	print((n - 1) * 2 + f)


a = []
a = input().split()
n = int(a[0])
d = int(a[1])
t = []
t = input().split()
sum = 0
for i in range(0, n):
	t[i] = int(t[i])
	sum = sum + t[i]
m = sum + (n - 1) * 10
if m > d:
	print('-1')
else:
	time = d - sum
	jokes = int(time / 5)
	print(jokes)


import math
ll = input().split()
n = int(ll[0])
d = int(ll[1])
lll = input().split()
s = 0
for i in range(n):
	s += int(lll[i])
s += (n - 1) * 10
if s > d:
	print('-1')
elif s == d:
	print((n - 1) * 2)
else:
	t = math.floor((d - s) / 5)
	print(t + (n - 1) * 2)


(n, d) = map(int, input().split())
nums = list(map(int, input().split()))
if sum(nums) + (n - 1) * 10 > d:
	print('-1')
else:
	k = d - sum(nums)
	print(k // 5)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
t = 0
songs = 0
jokes = 0
for i in range(n):
	t += a[i]
	if t <= d:
		songs += 1
		t += 10
		if t > d:
			t -= 10
			p = d - t
			break
		else:
			jokes += 2
p = d - t
if songs != n:
	print(-1)
else:
	print(jokes + p // 5)


(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
cnt = x = 0
a = 1
z = 0
for i in range(n):
	if l[i] <= k and a:
		k -= l[i]
		x += 1
	else:
		z = 1
		break
	if k >= 10:
		cnt += 2
		k -= 10
		a = 1
	elif k >= 5:
		a = 0
		k -= 5
		cnt += 1
if z:
	print(-1)
elif k < 5:
	print(cnt)
else:
	print(k // 5 + cnt)


import sys
f = sys.stdin
(n, d) = map(int, f.readline().strip().split())
t = list(map(int, f.readline().strip().split()))
s = sum(t)
if 10 * (n - 1) + s > d:
	print(-1)
else:
	jokes = 0
	d -= s
	print(d // 5)


import math, fractions
(n, d) = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
nrest = len(q) - 1
if sum(q) + 10 * nrest > d:
	print(-1)
else:
	ans = 2 * nrest + (d - sum(q) - 10 * nrest) // 5
	print(ans)


(n, d) = [int(s) for s in input().split()]
t = [int(s) for s in input().split()]
k = sum(t) + (n - 1) * 10
if k > d:
	print(-1)
else:
	print((n - 1) * 2 + (d - k) // 5)


line = input().split()
n = int(line[0])
d = int(line[1])
line = input().split()
line = [int(i) for i in line]
if sum(line) + (n - 1) * 10 <= d:
	print((d - sum(line)) // 5)
else:
	print(-1)


(n, t) = map(int, input().split())
x = (t - sum(map(int, input().split()))) // 5
print(-1 if n * 2 - 2 > x else x)


(n, d) = map(int, input().split())
s = sum(map(int, input().split())) + 10 * (n - 1)
if s > d:
	print(-1)
else:
	print(2 * (n - 1) + (d - s) // 5)


(n, d) = map(int, input().split())
ts = [int(s) for s in input().split()]
if sum(ts) + 10 * (n - 1) > d:
	print(-1)
else:
	b = (d - sum(ts)) // 5
	print(b)


(n, t) = map(int, input().split())
a = list(map(int, input().split()))
total = sum(a) + 10 * (n - 1)
if t < total:
	print(-1)
else:
	rem = t - total
	count = 2 * (n - 1) + rem // 5
	print(count)


(n, d) = map(int, input().split())
l = [int(x) for x in input().split()]
a = 10 * (n - 1) + sum((l[k] for k in range(n)))
if a > d:
	print(-1)
else:
	print((n - 1) * 2 + int((d - a) / 5))


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
sum_time = (n - 1) * 10 + sum(t)
if sum_time > d:
	print(-1)
else:
	res_time = d - sum_time
	cnt = res_time / 5 + (n - 1) * 2
	print(int(cnt))


(n, d) = input().split()
n = int(n)
d = int(d)
mintime = 10 * (n - 1)
line = [int(i) for i in input().split()]
for i in line:
	mintime += i
if mintime > d:
	print(-1)
else:
	comedy = 2 * (n - 1) + int((d - mintime) / 5)
	print(comedy)


import sys

def data():
	return sys.stdin.readline().strip()

def sp():
	return map(int, data().split())

def l():
	return list(sp())
temp = l()
n = temp[0]
d = temp[1]
songs = l()
if sum(songs) + (n - 1) * 10 <= d:
	print((d - sum(songs)) // 5)
else:
	print(-1)
	exit()


nn = input()
(n, tiempo) = nn.strip().split()
canciones = input()
canciones = canciones.strip().split()
check = len(canciones) - 1
valor = 0
for cancion in canciones:
	valor = valor + int(cancion)
final = valor + check * 10
if final > int(tiempo):
	print(-1)
else:
	chistes = (int(tiempo) - valor) / 5
	print(int(chistes))


(n, d) = list(map(int, input().split()))
lst = list(map(int, input().split()))
songsWithJokes = sum(lst) + (n - 1) * 10
if songsWithJokes > d:
	print('-1')
else:
	print(2 * n - 2 + (d - songsWithJokes) // 5)


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
tot = sum(arr) + (n - 1) * 10
if tot > d:
	print(-1)
else:
	joke = (n - 1) * 2
	if d > tot:
		joke += (d - tot) // 5
	print(joke)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
(i, f) = (0, 0)
c = 0
x = d
while i < n - 1 and d:
	if d >= l[i] + 10:
		d -= l[i] + 10
		c += 2
	else:
		break
	i += 1
if d >= l[i] and i == n - 1:
	d -= l[i]
	f = 1
if x == d:
	print(-1)
elif f == 1:
	if d > 0:
		c += d // 5
	print(c)
else:
	print(-1)


(n, k) = map(int, input().split(' '))
arr = [int(i) for i in input().split(' ')]
sum = sum(arr)
res = (k - sum - (n - 1) * 10) // 5
if res < 0:
	print(-1)
else:
	print(2 * (n - 1) + res)


from sys import stdin, stdout
nd = list(map(int, stdin.readline().strip().split()))
n = nd[0]
d = nd[1]
time_lst = list(map(int, stdin.readline().split()))
time1 = (n - 1) * 10
song_time = 0
for i in time_lst:
	song_time += i
if song_time + time1 > d:
	stdout.write('-1')
else:
	extra_time = d - (song_time + time1)
	total_jokes = (time1 + extra_time) // 5
	stdout.write(str(total_jokes))


inp = list(map(int, input().split(' ')))
div = inp[0]
k = inp[1]
jokes = 0
songs = list(map(int, input().split(' ')))
if (len(songs) - 1) * 10 + sum(songs) > k:
	print('-1')
else:
	time_rem = k - sum(songs)
	jokes = time_rem // 5
	print(int(jokes))


import math
a = [int(x) for x in input().split()]
n = a[0]
d = a[1]
t = [int(x) for x in input().split()]
k = sum(t) + 10 * (n - 1)
if k > d:
	print('-1')
else:
	print(2 * (n - 1) + math.floor((d - k) / 5))


I = lambda : map(int, input().split())
(n, d, *a) = (*I(), *I())
x = (d - sum(a)) // 5
print((-1, x)[sum(a) + 10 * (len(a) - 1) <= d])


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
ch = 1
sn = sum(a)
rst = (n - 1) * 10
mx = 0
if sn + rst > d:
	ch = 0
else:
	x = d - sn
	mx = x // 5
if ch == 0:
	print(-1)
else:
	print(mx)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
k = sum(l) + 10 * (len(l) - 1)
if k <= d:
	d = d - sum(l)
	print(d // 5)
else:
	print('-1')


inp = input().split()
n = int(inp[0])
d = int(inp[1])
sum = 0
inp = input().split()
for i in range(n):
	sum = sum + int(inp[i])
ans = 0
ost = 0
if sum + (n - 1) * 10 > d:
	print(-1)
	exit()
ans = (n - 1) * 2
ost = int(d - ans * int(5) - sum)
ans += ost // 5
print(ans)


__author__ = 'DOAN Minh Quy'
line = input().split()
n = int(line[0])
d = int(line[1])
line = input().split()
times = []
for i in range(n):
	times.append(int(line[i]))
total = sum(times)
if total + 2 * (n - 1) * 5 <= d:
	print((d - total) // 5)
else:
	print(-1)


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
time = 0
i = 0
jokes = 0
while time <= d and i < n:
	if time + t[i] <= d:
		time += t[i]
		i += 1
	else:
		break
	if time + 5 <= d:
		time += 5
		jokes += 1
	else:
		break
	if time + 5 <= d:
		time += 5
		jokes += 1
	else:
		break
if i != n:
	print(-1)
else:
	left = d - time
	jokes += left // 5
	print(jokes)


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
breaktimecnt = (n - 1) * 2
studytime = list(map(int, input().split()))
mintime = (n - 1) * 10 + sum(studytime)
if mintime > m:
	print(-1)
else:
	print((m - mintime) // 5 + breaktimecnt)


first = input().split(' ')
n = int(first[0])
d = int(first[1])
second = input().split(' ')
jokes = 0
organized = True
for i in range(0, n):
	t = int(second[i])
	if t <= d:
		d -= t
		if i == n - 1 and d >= 5:
			jokes += int(d / 5)
		elif d < 10 and i < n - 1:
			organized = False
			break
		elif d > 10:
			d -= 10
			jokes += 2
	else:
		organized = False
		break
if organized:
	print(jokes)
else:
	print(-1)


(n, d) = map(int, input().split())
songs = list(map(int, input().split()))
(t, i, ans) = (0, 0, 0)
while i < n and t < d:
	if t + songs[i] <= d:
		t += songs[i]
	else:
		break
	if t + 5 <= d:
		ans += 1
	t += 5
	if t + 5 <= d:
		ans += 1
	t += 5
	i += 1
if i < n:
	print(-1)
elif t >= d:
	print(ans)
else:
	print(ans + (d - t) // 5)


(n, d) = map(int, input().split())
lis = list(map(int, input().split()))
s = sum(lis)
if s + (n - 1) * 10 <= d:
	r = d - s
	print(r // 5)
else:
	print(-1)


(n, d) = map(int, input().split(' '))
ns = list(map(int, input().split(' ')))
if d < sum(ns) + 10 * (len(ns) - 1):
	print(-1)
else:
	answer = (d - sum(ns)) // 5
	print(answer)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
m = (n - 1) * 10 + sum(l)
if m == d:
	print((n - 1) * 2)
elif m < d:
	d = d - m
	print((n - 1) * 2 + d // 5)
else:
	print(-1)


(a, b) = map(int, input().split())
lis = list(map(int, input().split()))
if a == 1 and b > a:
	print((b - sum(lis)) // 5)
elif b - sum(lis) >= (a - 1) * 10:
	print((b - sum(lis)) // 5)
else:
	print(-1)


(n, d) = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
count = 0
i = 0
if d < sum(l) + 10 * (len(l) - 1):
	print(-1)
else:
	while d > 0 and i < len(l):
		d -= l[i]
		if d == 0:
			print(count)
			break
		count = count + 1 if d - 5 >= 0 else count
		d -= 5
		if d <= 0:
			print(count)
			break
		count = count + 1 if d - 5 >= 0 else count
		d -= 5
		if d <= 0:
			print(count)
			break
		i += 1
if d > 0 and i == len(l):
	count += d // 5
	print(count)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = 1
	rr = []
	for _ in range(t):
		(n, d) = LI()
		t = LI()
		if sum(t) + (n - 1) * 10 > d:
			rr.append(-1)
		else:
			rr.append((d - sum(t)) // 5)
	return JA(rr, '\n')
print(main())


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
x = sum(t) + (n - 1) * 10
m = (n - 1) * 2
if x > d:
	print(-1)
elif x == d:
	print(m)
else:
	while x < d:
		x += 5
		if x <= d:
			m += 1
	print(m)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
readint = lambda : int(sys.stdin.readline().rstrip('\r\n'))
readints = lambda : map(int, sys.stdin.readline().rstrip('\r\n').split())
readstr = lambda : sys.stdin.readline().rstrip('\r\n')
readstrs = lambda : map(str, sys.stdin.readline().rstrip('\r\n').split())
readarri = lambda : [int(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
readarrs = lambda : [str(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]

def solve():
	(n, dur) = readints()
	arr = readarri()
	singer = sum(arr)
	comedian = 10 * (n - 1)
	if singer + comedian > dur:
		print(-1)
		return
	print((n - 1 << 1) + (dur - (sum(arr) + comedian)) // 5)

def main():
	t = 1
	for _ in range(t):
		solve()
main()


(n, d) = map(int, input().split())
arr = [int(x) for x in input().split()]
minTime = 0
for i in arr:
	minTime += i
minTime += 10 * (n - 1)
restTime = d - minTime
if restTime < 0:
	print('-1')
else:
	print(str((n - 1) * 2 + restTime // 5))


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, d) = get_ints()
Arr = get_array()
total = sum(Arr) + (n - 1) * 10
if total > d:
	print(-1)
	exit()
print(2 * (n - 1) + (d - total) // 5)


(n, d) = map(int, input().split())
T = list(map(int, input().split()))
time = sum(T) + (n - 1) * 10
if time <= d:
	print((d - sum(T)) // 5)
else:
	print(-1)


import sys
import math as m

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def sinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def ninp():
	return map(int, sys.stdin.readline().strip().split())

def linp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(a):
	print(a)
(n, d) = ninp()
t = linp()
if d < (n - 1) * 10 + sum(t):
	print(-1)
else:
	left = d - sum(t)
	print(left // 5)


import sys
(n, d) = [int(i) for i in input().split(' ')]
sum1 = sum([int(i) for i in input().split(' ')])
if sum1 + (n - 1) * 10 > d:
	print(-1)
else:
	print(int((d - (sum1 + (n - 1) * 10)) / 5) + 2 * (n - 1))


(N, D) = map(int, input().split())
A = list(map(int, input().split()))
reset = (N - 1) * 10
if sum(A) + reset > D:
	print(-1)
else:
	print((D - sum(A)) // 5)


import sys
input = sys.stdin.buffer.readline
(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
if sum(arr) + 10 * (n - 1) > d:
	print('-1')
else:
	print((d - sum(arr)) // 5)


(x, y) = map(int, input().split())
z = list(map(int, input().split()))
jokes = (x - 1) * 2
y = y - (x - 1) * 10
i = 0
while i < x:
	y -= z[i]
	i += 1
if y < 0:
	jokes = -1
if y >= 5:
	jokes += y // 5
print(jokes)


n = input()
d = input()

def format_input(n, d):
	formatted_n = n.split()
	formatted_d = [int(x) for x in d.split()]
	return (int(formatted_n[1]), formatted_d)

def solve(n, d):
	(time_limit, songs) = format_input(n, d)
	devu_time = sum(songs)
	length_of_total_breaks = 10 * (len(songs) - 1)
	if devu_time + length_of_total_breaks <= time_limit:
		remaining_time = time_limit - devu_time
		number_of_jokes = remaining_time // 5
		return number_of_jokes
	else:
		return -1
print(solve(n, d))


l = input().split()
n = int(l[0])
d = int(l[1])
s = input().split()
s_min = 0
for x in range(n):
	s_min += int(s[x])
if s_min + 10 * (n - 1) <= d:
	print((d - s_min) // 5)
else:
	print(-1)


(n, k) = map(int, input().split())
songs = [int(i) for i in input().split()]
sum_s = sum(songs)
breaks = len(songs) - 1
k -= sum_s
jokes = breaks * 2
k -= breaks * 10
if k >= 0:
	jokes += k // 5
	print(jokes)
else:
	print(-1)


(n, d) = map(int, input().split())
time = list(map(int, input().split()))
sum_time = 0
for i in range(n):
	sum_time = sum_time + time[i]
if sum_time + 10 * (n - 1) <= d:
	print((d - sum_time) // 5)
else:
	print(-1)


import math
(a, b) = map(int, input().split())
(c, *d) = map(int, input().split())
d.append(c)
z = int(math.fsum(d)) + (a - 1) * 10
if z > b:
	print(-1)
elif z == b:
	print((a - 1) * 2)
elif z < b:
	x = 0
	w = 0
	while 5 + x + z <= b:
		x += 5
		w += 1
	print((a - 1) * 2 + w)


nd = input().split()
n = int(nd[0])
d = int(nd[1])
count = 0
singTimeSum = 0
for t in input().split():
	singTimeSum += int(t) + 10
	count += 2
singTimeSum -= 10
count -= 2
if d - singTimeSum < 0:
	count = -1
else:
	count += (d - singTimeSum) / 5
print(int(count))


(n, d) = [int(i) for i in input().split()]
songList = [int(i) for i in input().split()]
minRuntime = sum(songList) + 10 * (n - 1)
if minRuntime > d:
	print(-1)
else:
	print(2 * (n - 1) + (d - minRuntime) // 5)


import math, os, sys
import string, re
import itertools, functools, operator
from collections import Counter

def inputint():
	return int(input())

def inputarray(func=int):
	return map(func, input().split())
(n, d) = inputarray()
s = sum(inputarray())
if s + 10 * (n - 1) > d:
	print(-1)
else:
	print((d - s) // 5)


(n, d) = map(int, input().split())
t = list(map(int, input().split()))
s = sum(t)
s += 10 * (n - 1)
if s > d:
	print(-1)
else:
	j = (n - 1) * 2
	j1 = (d - s) // 5
	j += j1
	print(j)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
time = (n - 1) * 10 + sum(l)
if time > d:
	print(-1)
else:
	ans = (n - 1) * 2 + (d - time) // 5
	print(ans)