The Fair Nut likes kvass very much. On his birthday parents presented him $n$ kegs of kvass. There are $v_i$ liters of kvass in the $i$-th keg. Each keg has a lever. You can pour your glass by exactly $1$ liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by $s$ liters of kvass. But he wants to do it, so kvass level in the least keg is as much as possible.

Help him find out how much kvass can be in the least keg or define it's not possible to pour his glass by $s$ liters of kvass.


-----Input-----

The first line contains two integers $n$ and $s$ ($1 \le n \le 10^3$, $1 \le s \le 10^{12}$) — the number of kegs and glass volume.

The second line contains $n$ integers $v_1, v_2, \ldots, v_n$ ($1 \le v_i \le 10^9$) — the volume of $i$-th keg.


-----Output-----

If the Fair Nut cannot pour his glass by $s$ liters of kvass, print $-1$. Otherwise, print a single integer — how much kvass in the least keg can be.


-----Examples-----
Input
3 3
4 3 5

Output
3

Input
3 4
5 3 4

Output
2

Input
3 7
1 2 3

Output
-1



-----Note-----

In the first example, the answer is $3$, the Fair Nut can take $1$ liter from the first keg and $2$ liters from the third keg. There are $3$ liters of kvass in each keg.

In the second example, the answer is $2$, the Fair Nut can take $3$ liters from the first keg and $1$ liter from the second keg.

In the third example, the Fair Nut can't pour his cup by $7$ liters, so the answer is $-1$.

Difficulty: interview

Starter code:

Solutions:
def doit():
    xx = input().split()
    n = int(xx[0])
    s = int(xx[1])
    v = [int(k) for k in input().split()]

    S = sum(v)
    newS = S - s
    if newS < 0:
        return -1
    return min(newS//n, min(v))
        
print(doit())


n, s = list(map(int, input().split()))

v = list(map(int, input().split()))

if sum(v) < s:
    print(-1)
    return

mv = min(v)

for i in range(n):
    s -= v[i] - mv

if s < 1:
    print(mv)
    return

ans = mv - s // n
if s % n != 0:
    ans -= 1

print(ans)





from sys import stdin, stdout
from math import sin, tan, cos, pi, atan2, sqrt, acos, atan, factorial


n, s = map(int, stdin.readline().split())
values = list(map(int, stdin.readline().split()))

l, r = -1, min(values) + 1
while r - l > 1:
    m = (l + r) >> 1
    
    cnt = 0
    for v in values:
        cnt += v - m
    
    if cnt >= s:
        l = m
    else:
        r = m

if l == -1:
    stdout.write('-1\n')
else:
    stdout.write(str(l) + '\n')

n, s = list(map(int, input().split()))

allCups = list(map(int, input().split()))
sumK = sum(allCups)
minK = min(allCups)
if sumK < s:
    print(-1)

else:
    if sumK - (minK * n) >= s:
        print(minK)
    else:
        s = s - (sumK - (minK * n))
        #print(s)
        if s % n == 0:
            print(minK - (s // n))
        else:
            print(minK - (s // n) - 1)


n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
d = sum(a)
if d >= s:
    r = d - s
    ans = min(r // n, a[0])
else:
    ans = -1

print(ans)


n, s = map(int, input().split())
num = list(map(int, input().split()))
x = sum(num)
if x < s:
    print(-1)
else:
    k = min(num)
    for i in range(n):
        s -= abs(num[i] - k)
        num[i] = k
    if s <= 0:
        print(k)
    else:
        q = s // n
        k -= q
        if s % n == 0:
            print(k)
        else:
            print(k - 1)

from math import ceil

n, s = list(map(int, input().split()))
A = list(map(int, input().split()))
if sum(A) < s:
    print(-1)
else:
    x = min(A)
    y = 0
    for k in range(n):
        y += (A[k] - x)
    if y >= s:
        print(x)
    else:
        a = s - y
        print(x - ceil(a / n))

n,s=map(int,input().split())
a=list(map(int,input().split()))
y=min(a)*n
x=sum(a)
if x<s:
    print(-1)
else:
    if s<=x-y:
        print(y//n)
    else:
       s=s-(x-y)
       print((y-s)//n)

import math
n,s=map(int,input().split())
v=list(map(int,input().split()))
x=sum(v)
if s>x:
    print(-1)
else:
    a=min(v)
    if s<x-n*a:
        print(a)
    else:
        b=x-n*a
        c=s-b
        print(a-math.ceil(c/n))

n, s = list(map(int, input().split()))
v = list(map(int, input().split()))
sm = sum(v)
sm -= s
if sm < 0:
    print(-1)
else:
    mn = min(v)
    r = min(mn, sm // n)
    print(r)


import math, sys, itertools

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

def main():
    n, s = mp()
    a = mp()
    sm = sum(a)
    if sm < s:
        print(-1)
        return
    ans = (sum(a) - s) // n
    print(min(ans, min(a)))
        

deb = 0
if deb:
    file = open('input.txt', 'r')
    input = file.readline
else:
    input = sys.stdin.readline
    
main()

n, s = list(map(int, input().split()))
v = [int(k) for k in input().split()]
v.sort(reverse=True)
for i in range(n):
    s -= v[i] - v[-1]
    v[i] = v[-1]
if s <= 0:
    print(v[-1])
else:
    if s > n * v[0]:
        print(-1)
    else:
        print(v[0] - (s + n - 1) // n)  


import math
n,s = list(map(int,input().split()))
v = input().split()
mini = math.inf
for i in range(n):
    mini = min(int(v[i]),mini)
s += mini*n
for i in range(n):
    s -= int(v[i])
if s < 0:
    print(mini)
elif s > mini*n:
    print(-1)
elif s%n == 0:
    print(mini-s//n)
else:
    print(mini-s//n-1)


n, s = list(map(int, input().split()))
v = [int(x) for x in input().split()]
t = sum(v)
if sum(v) < s:
	print(-1)
	return
b = min(v)
kol = t - b * n
s -= kol
if s <= 0:
	print(b)
	return
tmp = (s + n - 1) // n
print(b - tmp)


n, s = map(int, input().split())
l = [*map(int, input().split())]
sm = sum(l)
if sm < s:
    print(-1)
    return
m = min(l)
s -= sm - m * n
if s <= 0:
    print(m)
else:
    print(m - (s + n - 1)//n)

n, s = map(int, input().split())
k = list(map(int, input().split()))
sumk = sum(k)
mink = min(k)
if sumk < s:
    print(-1)
    return
if sumk-n*mink >= s:
    print(mink)
else:
    s -= sumk-n*mink
    if s%n == 0:
        print(mink-s//n)
    else:
        print(mink-s//n-1)

import math
n,q=list(map(int,input().split()))
h=list(map(int,input().split()))
t=0
for i in range (n):
    t+=h[i]
if t<q:
    print(-1)
    return
low=min(h)
for i in range (n):
    q-=(h[i]-low)
if q<=0:
    print(low)
    return
low-=math.ceil(q/n)
print(low)


n,s = map(int,input().split())
l = list(map(int, input().split()))

if sum(l) < s:
	print(-1)
	return
q = sum(l) - min(l) * n
if q>=s:
	print(min(l))
	return
print(min(l)-(s-q+n-1)//n)

n, S = [int(x) for x in input().split()]

A = [int(x) for x in input().split()]

def ans():
  nonlocal S
  to_min = sum(A) - n*min(A)
  S -= to_min
  if S <= 0:
    return min(A)
  if n*min(A) < S: return -1
  return (n*min(A) - S) // n

print(ans())


n, s = list(map(int, input().split()))
u = list(map(int, input().split()))
mu = min(u)
su = sum(u)
if su < s:
    print(-1)
else:
    s -= (su - mu * n)
    if s <= 0:
        print(mu)
    else:
        k = s // n
        if s % n != 0:
            k += 1
        print(mu - k)


n, k = list(map(int, input().split(' ')))

a = list(map(int, input().split(' ')))

minV = min(a)

s = sum(a)

if(k > s):
  print(-1)
else:
  rest = s - minV * n
  if(rest >= k):
    print(minV)
  else:
    k -= rest
    
    sol = k // n
    if(k % n):
      sol += 1

    print(minV - sol)

def ifPoss(arr,v,h):
    tot = 0
    for i in arr:
        tot += (i-h)
    return tot>=v
def prog():
    n,v = map(int,input().split())
    arr = [int(x) for x in input().split()]
    minLev = -1
    l,h = 0,min(arr)
    while(l<=h):
        m = int((l+h)/2)
        if(ifPoss(arr,v,m)):
            minLev = max(minLev,m)
            l = m+1
        else:
            h = m-1
    return minLev
print(prog())

#!/usr/bin/env python
# coding: utf-8

# In[15]:


import math
ns=list(map(int, input().rstrip().split()))
n=ns[0]
s=ns[1]

data=list(map(int, input().rstrip().split()))


# In[16]:


data.sort()


# In[17]:


extras=[i-data[0] for i in data]


# In[18]:


total=sum(data)
extratotal=sum(extras)


# In[ ]:





# In[19]:


if s>total:
    print(-1)
elif extratotal>=s:
    print(data[0])    
else:
    sub=math.ceil((s-extratotal)/n)
    print(data[0]-sub)
    


# In[ ]:



import sys
from math import ceil


def main():
    n, s = map(int, sys.stdin.readline().split())
    arr = list(map(int, sys.stdin.readline().split()))
    if s > sum(arr):
        print(-1, sep=' ', end='\n', file=sys.stdout, flush=False)
    else:
        count = 0
        arr.sort(reverse=True)
        for i in range(n-1):
            if count == s:
                break
            if count+(arr[i]-arr[-1]) <= s:
                count += arr[i]-arr[-1]
                arr[i] = arr[-1]
            elif count+(arr[i]-arr[-1]) > s:
                count = s
                arr[i] -= (s-count)
        if count == s:
            print(arr[-1])
        else:
            factor = (s-count)/n

            print(arr[-1]-ceil(factor), sep=' ', end='\n', file=sys.stdout, flush=False)


def __starting_point():
    main()

__starting_point()