import java.util.*;
import java.io.*;
public class Main {
static int N = 1000010;
static int a[] = new int[N]; // 学校分数线
static int n, need;
static boolean check(int x) {
long s = 0;
for(int i = 0; i < n; i ++ ) {
s += Math.max(a[i] - x, 0);
}
return s >= need;
}
public static void main(String[] args){
Reader sc = new Reader();
n = sc.nextInt();
need = sc.nextInt();
for(int i = 0; i < n; i ++ )
a[i] = sc.nextInt();
int l = 0, r = (int)1e9;
while(l < r) {
int mid = l + r + 1 >> 1;
if(check(mid))
l = mid;
else r = mid - 1;
}
System.out.println(l);
}
static class Reader {
public BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public StreamTokenizer st = new StreamTokenizer(br);
public void token() {
try {
st.nextToken();
} catch (IOException e) {}
}
public int nextInt() {
token();
return (int)st.nval;
}
public String next() {
token();
return st.sval;
}
}
}