import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
//import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.*;
public class PJ  {
    static HashMap<Long,Long> hs;

    public static void main(String[] args) throws Exception
    {
    	StringTokenizer st ;
    	Scanner sc = new Scanner(System.in);
    	boolean file = false;
		BufferedReader br =!file?new BufferedReader(new InputStreamReader(System.in)):new BufferedReader(new FileReader("leaves.in"));
		PrintWriter out  = new PrintWriter(System.out);
		st = new StringTokenizer(br.readLine());
		long n = Integer.parseInt(st.nextToken());long s = Long.parseLong(st.nextToken());
		st = new StringTokenizer(br.readLine());
		int[] arr = new int[(int)n];
		int min = Integer.MAX_VALUE;
		for(int i=0;i<n;i++)
		{
			arr[i] = Integer.parseInt(st.nextToken());
			min=Math.min(min, arr[i]);
		}
		for(int i=0;i<n;i++)
			s -= arr[i]-min;
		long sum = 1l*n*min;
		sum-=s;
		long ans = sum/n;
		//out.println(sum + " " +(sum/n));
		out.println(sum>=0?ans:-1);
		out.flush();
		out.close();
    }

    static boolean plus(char c)
    {
    	return c=='+';
    }
    static int log(int x, int base)
    {
        return (int) (Math.log(x) / Math.log(base));
    }
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
//import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.*;
public class PJ  {
    static HashMap<Long,Long> hs;

    public static void main(String[] args) throws Exception
    {
    	StringTokenizer st ;
    	Scanner sc = new Scanner(System.in);
    	boolean file = false;
		BufferedReader br =!file?new BufferedReader(new InputStreamReader(System.in)):new BufferedReader(new FileReader("leaves.in"));
		PrintWriter out  = new PrintWriter(System.out);
		st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken()),s = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(br.readLine());
		int[] arr = new int[n];
		int min = Integer.MAX_VALUE;
		for(int i=0;i<n;i++)
		{
			arr[i] = Integer.parseInt(st.nextToken());
			min=Math.min(min, arr[i]);
		}
		for(int i=0;i<n;i++)
			s -= arr[i]-min;

		min-= Math.ceil(s/(double)n);
		out.println(min>=0?min:-1);
		out.flush();
		out.close();
    }

    static boolean plus(char c)
    {
    	return c=='+';
    }
    static int log(int x, int base)
    {
        return (int) (Math.log(x) / Math.log(base));
    }
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
//import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.*;
public class PJ  {
    static HashMap<Long,Long> hs;

    public static void main(String[] args) throws Exception
    {
    	StringTokenizer st ;
    	Scanner sc = new Scanner(System.in);
    	boolean file = false;
		BufferedReader br =!file?new BufferedReader(new InputStreamReader(System.in)):new BufferedReader(new FileReader("leaves.in"));
		PrintWriter out  = new PrintWriter(System.out);
		st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());long s = Long.parseLong(st.nextToken());
		st = new StringTokenizer(br.readLine());
		int[] arr = new int[n];
		int min = Integer.MAX_VALUE;
		for(int i=0;i<n;i++)
		{
			arr[i] = Integer.parseInt(st.nextToken());
			min=Math.min(min, arr[i]);
		}
		for(int i=0;i<n;i++)
			s -= arr[i]-min;

		min-= Math.ceil(s/(double)n);
		out.println(min>=0?min:-1);
		out.flush();
		out.close();
    }

    static boolean plus(char c)
    {
    	return c=='+';
    }
    static int log(int x, int base)
    {
        return (int) (Math.log(x) / Math.log(base));
    }
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
//import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.*;
public class PJ  {
    static HashMap<Long,Long> hs;

    public static void main(String[] args) throws Exception
    {
    	StringTokenizer st ;
    	//Scanner sc = new Scanner(System.in);
    	boolean file = false;
		BufferedReader br =!file?new BufferedReader(new InputStreamReader(System.in)):new BufferedReader(new FileReader("leaves.in"));
		PrintWriter out  = new PrintWriter(System.out);
		st = new StringTokenizer(br.readLine());
		long n = Integer.parseInt(st.nextToken());long s = Long.parseLong(st.nextToken());
		st = new StringTokenizer(br.readLine());
		long[] arr = new long[(int)n];
		long min = Long.MAX_VALUE;
		for(int i=0;i<n;i++)
		{
			arr[i] = Integer.parseInt(st.nextToken());
			min=Math.min(min, arr[i]);
		}
		for(int i=0;i<n;i++)
			s -=arr[i]-min;
		long sum=(1l*n)*min;
	       if (s<=0){
	           out.println(min);
	       }
	       else{
	           if (sum<s){
	               out.println(-1);
	           }
	           else {
	               sum-=(s);
	               long ans = sum/n;
	               out.println(ans);
	           }
	       }
		out.flush();
		out.close();
    }
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
//import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.*;
public class PJ  {
    static HashMap<Long,Long> hs;

    public static void main(String[] args) throws Exception
    {
    	StringTokenizer st ;
    	//Scanner sc = new Scanner(System.in);
    	boolean file = false;
		BufferedReader br =!file?new BufferedReader(new InputStreamReader(System.in)):new BufferedReader(new FileReader("leaves.in"));
		PrintWriter out  = new PrintWriter(System.out);
		st = new StringTokenizer(br.readLine());
		long n = Integer.parseInt(st.nextToken());long s = Long.parseLong(st.nextToken());
		st = new StringTokenizer(br.readLine());
		long[] arr = new long[(int)n];
		long min = Long.MAX_VALUE;
		for(int i=0;i<n;i++)
		{
			arr[i] = Integer.parseInt(st.nextToken());
			min=Math.min(min, arr[i]);
		}
		for(int i=0;i<n;i++)
			s -=arr[i]-min;
		long sum = 1l*n*min;
		sum-=s;
		long ans = sum/n;
		//out.println(sum + " " +(sum/n));
		out.println(sum>=0?ans:-1);
		out.flush();
		out.close();
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author DY
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        BKvassAndTheFairNut solver = new BKvassAndTheFairNut();
        solver.solve(1, in, out);
        out.close();
    }

    static class BKvassAndTheFairNut {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int N = in.readInt();
            long S = in.readLong();
            long[] V = new long[N];
            for (int i = 0; i < N; ++i) V[i] = in.readLong();
            long l = -1, r = (long) 1e9 + 1;
            while (l + 1 < r) {
                long mid = l + (r - l) / 2;
                long max = 0;
                for (int i = 0; i < N; ++i) max += Math.min(V[i] - mid, V[i]);
                if (max >= S)
                    l = mid;
                else
                    r = mid;
            }
            out.printLine(l);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(long i) {
            writer.println(i);
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author DY
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        BKvassAndTheFairNut solver = new BKvassAndTheFairNut();
        solver.solve(1, in, out);
        out.close();
    }

    static class BKvassAndTheFairNut {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int N = in.readInt();
            long S = in.readLong();
            long[] V = new long[N];
            for (int i = 0; i < N; ++i) V[i] = in.readLong();
            long l = -1, r = (long) 1e9 + 1;
            while (l + 1 < r) {
                long mid = l + (r - l) / 2;
                long max = 0;
                boolean larger = true;
                for (int i = 0; i < N; ++i) {
                    max += Math.min(V[i] - mid, V[i]);
                    larger &= mid <= V[i];
                }
                if (larger && max >= S)
                    l = mid;
                else
                    r = mid;
            }
            out.printLine(l);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author DY
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        BKvassAndTheFairNut solver = new BKvassAndTheFairNut();
        solver.solve(1, in, out);
        out.close();
    }

    static class BKvassAndTheFairNut {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int N = in.readInt();
            long S = in.readLong();
            long[] V = new long[N];
            for (int i = 0; i < N; ++i) V[i] = in.readLong();
            long l = -1, r = (long) 1e9 + 1;
            while (l + 1 < r) {
                long mid = l + (r - l) / 2;
                long max = 0;
                for (int i = 0; i < N; ++i) max += Math.min(V[i] - mid, V[i]);
                if (max >= S)
                    l = mid;
                else
                    r = mid;
            }
            out.printLine(l);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.*;
import java.util.*;

@SuppressWarnings("unused")
public class Main {
    private FastScanner in;
    private PrintWriter out;
    final int MOD = (int)1e9+7;
    long ceil(long a, long b){return (a + b - 1) / b;}
    long gcd(long a, long b){return b == 0 ? a : gcd(b, a % b);}
    long lcm(long a, long b){return a / gcd(a, b) * b; /*オーバーフローに注意*/}

    void solve() {
        int n = in.nextInt();
        long s = in.nextLong();
        long[] v = new long[n];
        long sum = 0, min = Long.MAX_VALUE;
        for(int i = 0; i < n; i++){
            v[i] = in.nextLong();
            sum += v[i];
            min = Math.min(min, v[i]);
        }

        if(sum < s){
            out.println("-1");
            return;
        }

        for(int i = 0; i < n; i++){
            s -= (v[i] - min);
            v[i] = min;
        }
        if(s <= 0){
            out.println(min);
        }else{
            out.println((min - 1 - (s / n)));
        }
    }
    //end solve

    public static void main(String[] args) {
        new Main().m();
    }

    private void m() {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        /*
        try {
            String path = "output.txt";
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));
        }catch (IOException e){
            e.printStackTrace();
        }
        */
        solve();
        out.flush();
        in.close();
        out.close();
    }

    static class FastScanner {
        private Reader input;

        public FastScanner() {this(System.in);}
        public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}
        public void close() {
            try {
                this.input.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        public int nextInt() {return (int) nextLong();}

        public long nextLong() {
            try {
                int sign = 1;
                int b = input.read();
                while ((b < '0' || '9' < b) && b != '-' && b != '+') {
                    b = input.read();
                }
                if (b == '-') {
                    sign = -1;
                    b = input.read();
                } else if (b == '+') {
                    b = input.read();
                }
                long ret = b - '0';
                while (true) {
                    b = input.read();
                    if (b < '0' || '9' < b) return ret * sign;
                    ret *= 10;
                    ret += b - '0';
                }
            } catch (IOException e) {
                e.printStackTrace();
                return -1;
            }
        }

        public double nextDouble() {
            try {
                double sign = 1;
                int b = input.read();
                while ((b < '0' || '9' < b) && b != '-' && b != '+') {
                    b = input.read();
                }
                if (b == '-') {
                    sign = -1;
                    b = input.read();
                } else if (b == '+') {
                    b = input.read();
                }
                double ret = b - '0';
                while (true) {
                    b = input.read();
                    if (b < '0' || '9' < b) break;
                    ret *= 10;
                    ret += b - '0';
                }
                if (b != '.') return sign * ret;
                double div = 1;
                b = input.read();
                while ('0' <= b && b <= '9') {
                    ret *= 10;
                    ret += b - '0';
                    div *= 10;
                    b = input.read();
                }
                return sign * ret / div;
            } catch (IOException e) {
                e.printStackTrace();
                return Double.NaN;
            }
        }

        public char nextChar() {
            try {
                int b = input.read();
                while (Character.isWhitespace(b)) {
                    b = input.read();
                }
                return (char) b;
            } catch (IOException e) {
                e.printStackTrace();
                return 0;
            }
        }

        public String nextStr() {
            try {
                StringBuilder sb = new StringBuilder();
                int b = input.read();
                while (Character.isWhitespace(b)) {
                    b = input.read();
                }
                while (b != -1 && !Character.isWhitespace(b)) {
                    sb.append((char) b);
                    b = input.read();
                }
                return sb.toString();
            } catch (IOException e) {
                e.printStackTrace();
                return "";
            }
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArrayDec(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        }

        public int[] nextIntArray1Index(int n) {
            int[] res = new int[n + 1];
            for (int i = 0; i < n; i++) {
                res[i + 1] = nextInt();
            }
            return res;
        }

        public long[] nextLongArray(int n) {
            long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArrayDec(int n) {
            long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            }
            return res;
        }

        public long[] nextLongArray1Index(int n) {
            long[] res = new long[n + 1];
            for (int i = 0; i < n; i++) {
                res[i + 1] = nextLong();
            }
            return res;
        }

        public double[] nextDoubleArray(int n) {
            double[] res = new double[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            }
            return res;
        }
    }
}


import java.io.*;
import java.util.*;

@SuppressWarnings("unused")
public class Main {
    private FastScanner in;
    private PrintWriter out;
    final int MOD = (int)1e9+7;
    long ceil(long a, long b){return (a + b - 1) / b;}
    long gcd(long a, long b){return b == 0 ? a : gcd(b, a % b);}
    long lcm(long a, long b){return a / gcd(a, b) * b; /*オーバーフローに注意*/}

    void solve() {
        int n = in.nextInt();
        long s = in.nextLong();
        long[] v = new long[n];
        long sum = 0, min = Long.MAX_VALUE;
        for(int i = 0; i < n; i++){
            v[i] = in.nextLong();
            sum += v[i];
            min = Math.min(min, v[i]);
        }

        if(sum < s){
            out.println("-1");
            return;
        }

        for(int i = 0; i < n; i++){
            s -= (v[i] - min);
            v[i] = min;
        }
        if(s <= 0){
            out.println(min);
        }else{
            out.println((min - 1 - ((s - 1) / n)));
        }
    }
    //end solve

    public static void main(String[] args) {
        new Main().m();
    }

    private void m() {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        /*
        try {
            String path = "output.txt";
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));
        }catch (IOException e){
            e.printStackTrace();
        }
        */
        solve();
        out.flush();
        in.close();
        out.close();
    }

    static class FastScanner {
        private Reader input;

        public FastScanner() {this(System.in);}
        public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}
        public void close() {
            try {
                this.input.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        public int nextInt() {return (int) nextLong();}

        public long nextLong() {
            try {
                int sign = 1;
                int b = input.read();
                while ((b < '0' || '9' < b) && b != '-' && b != '+') {
                    b = input.read();
                }
                if (b == '-') {
                    sign = -1;
                    b = input.read();
                } else if (b == '+') {
                    b = input.read();
                }
                long ret = b - '0';
                while (true) {
                    b = input.read();
                    if (b < '0' || '9' < b) return ret * sign;
                    ret *= 10;
                    ret += b - '0';
                }
            } catch (IOException e) {
                e.printStackTrace();
                return -1;
            }
        }

        public double nextDouble() {
            try {
                double sign = 1;
                int b = input.read();
                while ((b < '0' || '9' < b) && b != '-' && b != '+') {
                    b = input.read();
                }
                if (b == '-') {
                    sign = -1;
                    b = input.read();
                } else if (b == '+') {
                    b = input.read();
                }
                double ret = b - '0';
                while (true) {
                    b = input.read();
                    if (b < '0' || '9' < b) break;
                    ret *= 10;
                    ret += b - '0';
                }
                if (b != '.') return sign * ret;
                double div = 1;
                b = input.read();
                while ('0' <= b && b <= '9') {
                    ret *= 10;
                    ret += b - '0';
                    div *= 10;
                    b = input.read();
                }
                return sign * ret / div;
            } catch (IOException e) {
                e.printStackTrace();
                return Double.NaN;
            }
        }

        public char nextChar() {
            try {
                int b = input.read();
                while (Character.isWhitespace(b)) {
                    b = input.read();
                }
                return (char) b;
            } catch (IOException e) {
                e.printStackTrace();
                return 0;
            }
        }

        public String nextStr() {
            try {
                StringBuilder sb = new StringBuilder();
                int b = input.read();
                while (Character.isWhitespace(b)) {
                    b = input.read();
                }
                while (b != -1 && !Character.isWhitespace(b)) {
                    sb.append((char) b);
                    b = input.read();
                }
                return sb.toString();
            } catch (IOException e) {
                e.printStackTrace();
                return "";
            }
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArrayDec(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        }

        public int[] nextIntArray1Index(int n) {
            int[] res = new int[n + 1];
            for (int i = 0; i < n; i++) {
                res[i + 1] = nextInt();
            }
            return res;
        }

        public long[] nextLongArray(int n) {
            long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArrayDec(int n) {
            long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            }
            return res;
        }

        public long[] nextLongArray1Index(int n) {
            long[] res = new long[n + 1];
            for (int i = 0; i < n; i++) {
                res[i + 1] = nextLong();
            }
            return res;
        }

        public double[] nextDoubleArray(int n) {
            double[] res = new double[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            }
            return res;
        }
    }
}


import java.io.*;
import java.util.*;

@SuppressWarnings("unused")
public class Main {
    private FastScanner in;
    private PrintWriter out;
    final int MOD = (int)1e9+7;
    long ceil(long a, long b){return (a + b - 1) / b;}
    long gcd(long a, long b){return b == 0 ? a : gcd(b, a % b);}
    long lcm(long a, long b){return a / gcd(a, b) * b; /*オーバーフローに注意*/}

    void solve() {
        StringBuilder sb = new StringBuilder();
        String s = in.nextStr();
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == 'a' || s.charAt(i) == 'b'){
                sb.append(s.charAt(i));
            }
        }

        ArrayList<Object[]> list = runLengthEncoding(sb.toString());
        ArrayList<Integer> num = new ArrayList<>(), sum = new ArrayList<>();
        for(Object[] e : list){
            char c = (char)e[0];
            int len = (int)e[1];
            if(c == 'b') continue;
            num.add(len);
            if(sum.size() == 0) sum.add(len);
            else sum.add(sum.get(sum.size()-1) + len);
        }

        long ans = sum.get(sum.size()-1);
        for(int i = 1; i < num.size(); i++){
            long m = (long)num.get(i) * sum.get(i-1);
            m %= MOD;
            ans += m;
            ans %= MOD;
        }
        out.println(ans);
    }
    //end solve

    ArrayList<Object[]> runLengthEncoding (String S){
        if(S.length() == 0) return null;
        char c = S.charAt(0);
        int len = 0;
        ArrayList<Object[]> list = new ArrayList<>();
        for(char e : S.toCharArray()){
            if(c == e){
                len++;
            }else{
                list.add(new Object[]{c, len});
                c = e;
                len = 1;
            }
        }
        list.add(new Object[]{c, len});
        return list;
    }

    public static void main(String[] args) {
        new Main().m();
    }

    private void m() {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        /*
        try {
            String path = "output.txt";
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));
        }catch (IOException e){
            e.printStackTrace();
        }
        */
        solve();
        out.flush();
        in.close();
        out.close();
    }

    static class FastScanner {
        private Reader input;

        public FastScanner() {this(System.in);}
        public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}
        public void close() {
            try {
                this.input.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        public int nextInt() {return (int) nextLong();}

        public long nextLong() {
            try {
                int sign = 1;
                int b = input.read();
                while ((b < '0' || '9' < b) && b != '-' && b != '+') {
                    b = input.read();
                }
                if (b == '-') {
                    sign = -1;
                    b = input.read();
                } else if (b == '+') {
                    b = input.read();
                }
                long ret = b - '0';
                while (true) {
                    b = input.read();
                    if (b < '0' || '9' < b) return ret * sign;
                    ret *= 10;
                    ret += b - '0';
                }
            } catch (IOException e) {
                e.printStackTrace();
                return -1;
            }
        }

        public double nextDouble() {
            try {
                double sign = 1;
                int b = input.read();
                while ((b < '0' || '9' < b) && b != '-' && b != '+') {
                    b = input.read();
                }
                if (b == '-') {
                    sign = -1;
                    b = input.read();
                } else if (b == '+') {
                    b = input.read();
                }
                double ret = b - '0';
                while (true) {
                    b = input.read();
                    if (b < '0' || '9' < b) break;
                    ret *= 10;
                    ret += b - '0';
                }
                if (b != '.') return sign * ret;
                double div = 1;
                b = input.read();
                while ('0' <= b && b <= '9') {
                    ret *= 10;
                    ret += b - '0';
                    div *= 10;
                    b = input.read();
                }
                return sign * ret / div;
            } catch (IOException e) {
                e.printStackTrace();
                return Double.NaN;
            }
        }

        public char nextChar() {
            try {
                int b = input.read();
                while (Character.isWhitespace(b)) {
                    b = input.read();
                }
                return (char) b;
            } catch (IOException e) {
                e.printStackTrace();
                return 0;
            }
        }

        public String nextStr() {
            try {
                StringBuilder sb = new StringBuilder();
                int b = input.read();
                while (Character.isWhitespace(b)) {
                    b = input.read();
                }
                while (b != -1 && !Character.isWhitespace(b)) {
                    sb.append((char) b);
                    b = input.read();
                }
                return sb.toString();
            } catch (IOException e) {
                e.printStackTrace();
                return "";
            }
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArrayDec(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        }

        public int[] nextIntArray1Index(int n) {
            int[] res = new int[n + 1];
            for (int i = 0; i < n; i++) {
                res[i + 1] = nextInt();
            }
            return res;
        }

        public long[] nextLongArray(int n) {
            long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArrayDec(int n) {
            long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            }
            return res;
        }

        public long[] nextLongArray1Index(int n) {
            long[] res = new long[n + 1];
            for (int i = 0; i < n; i++) {
                res[i + 1] = nextLong();
            }
            return res;
        }

        public double[] nextDoubleArray(int n) {
            double[] res = new double[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            }
            return res;
        }
    }
}


import java.io.*;
import java.util.*;
public class B526 {

	public static void main(String[] args) throws Exception{
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(f.readLine());

		int N = Integer.parseInt(st.nextToken());
		long k = Long.parseLong(st.nextToken());

		int[] vol = new int[N];

		st = new StringTokenizer(f.readLine());

		long min = Integer.MAX_VALUE;
		for(int i = 0;i<N;i++) {
			vol[i] = Integer.parseInt(st.nextToken());
			min = Math.min(min, vol[i]);
		}

		for(int i = 0;i<N;i++) {
			k -= vol[i] - min;
		}

		if(k <= 0) {
			System.out.println(min);
			System.exit(0);
		}
		if(min*N < k) {
			System.out.println(-1);
		}
		else {
			System.out.println(min - 1 - (k-1)/N);
		}
	}

}


import java.io.*;
import java.util.*;
public class B526 {

	public static void main(String[] args) throws Exception{
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(f.readLine());

		int N = Integer.parseInt(st.nextToken());
		long k = Integer.parseInt(st.nextToken());

		int[] vol = new int[N];

		st = new StringTokenizer(f.readLine());

		int min = Integer.MAX_VALUE;
		for(int i = 0;i<N;i++) {
			vol[i] = Integer.parseInt(st.nextToken());
			min = Math.min(min, vol[i]);
		}

		for(int i = 0;i<N;i++) {
			k -= vol[i] - min;
		}

		if(k <= 0) {
			System.out.println(min);
			System.exit(0);
		}
		if(min*N < k) {
			System.out.println(-1);
		}
		else {
			System.out.println(min - 1 - (k-1)/N);
		}
	}

}


import java.io.*;
import java.util.*;
public class B526 {

	public static void main(String[] args) throws Exception{
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(f.readLine());

		int N = Integer.parseInt(st.nextToken());
		long k = Long.parseLong(st.nextToken());

		int[] vol = new int[N];

		st = new StringTokenizer(f.readLine());

		int min = Integer.MAX_VALUE;
		for(int i = 0;i<N;i++) {
			vol[i] = Integer.parseInt(st.nextToken());
			min = Math.min(min, vol[i]);
		}

		for(int i = 0;i<N;i++) {
			k -= vol[i] - min;
		}

		if(k <= 0) {
			System.out.println(min);
			System.exit(0);
		}
		if(min*N < k) {
			System.out.println(-1);
		}
		else {
			System.out.println(min - 1 - (k-1)/N);
		}
	}

}


import java.io.*;
import java.util.*;
public class B526 {

	public static void main(String[] args) throws Exception{
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(f.readLine());

		int N = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());

		int[] vol = new int[N];

		st = new StringTokenizer(f.readLine());

		int min = Integer.MAX_VALUE;
		for(int i = 0;i<N;i++) {
			vol[i] = Integer.parseInt(st.nextToken());
			min = Math.min(min, vol[i]);
		}

		for(int i =0;i<N;i++) {
			k -= vol[i] - min;
		}

		if(k <= 0) {
			System.out.println(min);
			System.exit(0);
		}
		if(min*N < k) {
			System.out.println(-1);
		}
		else {
			System.out.println(min - 1 - k/N);
		}
	}

}


import java.io.*;
import java.util.*;
public class B526 {

	public static void main(String[] args) throws Exception{
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(f.readLine());

		int N = Integer.parseInt(st.nextToken());
		long k = Integer.parseInt(st.nextToken());

		int[] vol = new int[N];

		st = new StringTokenizer(f.readLine());

		int min = Integer.MAX_VALUE;
		for(int i = 0;i<N;i++) {
			vol[i] = Integer.parseInt(st.nextToken());
			min = Math.min(min, vol[i]);
		}

		for(int i =0;i<N;i++) {
			k -= vol[i] - min;
		}

		if(k <= 0) {
			System.out.println(min);
			System.exit(0);
		}
		if(min*N < k) {
			System.out.println(-1);
		}
		else {
			System.out.println(min - 1 - k/N);
		}
	}

}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class demo {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);

		Long size = s.nextLong();
		Long need = s.nextLong();

		ArrayList<Long> a = new ArrayList<Long>();

		for(int i=0;i<size;i++)
		{
			a.add(s.nextLong());

		}

		Long min = Collections.min(a);

		Long add = 0L;
		for( Long val : a)
		{
			add += val-min;
		}

		if(add> need)
		{
			System.out.print(min);
		}
		else
		{
			if(size == 0)
			{
				System.out.print(-1);
				return;
			}
			need = need - add;
			Long iter = need/size;
			if(need%size !=0)
				iter++;

			min = min-iter;

			if(min<0)
				System.out.print(-1);
			else
				System.out.print(min);
		}

	}

}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class demo {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);

		int size = s.nextInt();
		int need = s.nextInt();

		ArrayList<Integer> a = new ArrayList<Integer>();

		for(int i=0;i<size;i++)
		{
			a.add(s.nextInt());

		}

		int min = Collections.min(a);

		int add = 0;
		for( int val : a)
		{
			add += val-min;
		}

		if(add> need)
		{
			System.out.print(min);
		}
		else
		{
			if(size == 0)
			{
				System.out.print(-1);
				return;
			}
			need = need - add;
			int iter = need/size;
			if(need%size !=0)
				iter++;

			min = min-iter;

			if(min<0)
				System.out.print(-1);
			else
				System.out.print(min);
		}

	}

}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class demo {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);

		int size = s.nextInt();
		int need = s.nextInt();

		ArrayList<Integer> a = new ArrayList<Integer>();

		for(int i=0;i<size;i++)
		{
			a.add(s.nextInt());

		}

		int min = Collections.min(a);

		int add = 0;
		for( int val : a)
		{
			add += val-min;
		}

		if(add> need)
		{
			System.out.print(min);
		}
		else
		{
			need = need - add;
			int iter = need/size;
			if(need%size !=0)
				iter++;

			min = min-iter;

			if(min<0)
				System.out.print(-1);
			else
				System.out.print(min);
		}

	}

}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by Mach on 10.12.2018.
 */
public class round526a {
    public static void main(String[] args) {
        Reader526a r=new Reader526a();
        r.init(System.in);

        int n=r.nextInt();
        long s=r.nextInt();
        int a[]=new int[n];
        int min=1000000001;
        int sum=0;
        for(int i=0; i<n; i++) {
            a[i]=r.nextInt();
            if (a[i]<min) min=a[i];
            sum=sum+a[i];
        }

        long res=-1;
        if (s<=(sum-min*n)) {System.out.println(min); return;}
        if (s>(sum)) {System.out.println(res); return;}
        res=((long)sum-s)/(long)n;
        System.out.println(res);

    }
}

class Reader526a {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() /* throws IOException */ {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            try {
                tokenizer = new StringTokenizer(
                        reader.readLine());
            } catch(Exception e) {e.printStackTrace();}
        }
        return tokenizer.nextToken();
    }

    static int nextInt() {
        return Integer.parseInt( next() );
    }

    static long nextLong(){ return (long)nextInt();}

    static double nextDouble() {
        return Double.parseDouble( next() );
    }

}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by Mach on 10.12.2018.
 */
public class round526a {
    public static void main(String[] args) {
        Reader526a r=new Reader526a();
        r.init(System.in);

        int n=r.nextInt();
        long s=r.nextInt();
        int a[]=new int[n];
        int min=1000000001;
        long sum=0;
        for(int i=0; i<n; i++) {
            a[i]=r.nextInt();
            if (a[i]<min) min=a[i];
            sum=sum+a[i];
        }

        long res=-1;
        if (s<=(sum-min*n)) {System.out.println(min); return;}
        if (s>(sum)) {System.out.println(res); return;}
        res=(sum-s)/(long)n;
        System.out.println(res);

    }
}

class Reader526a {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() /* throws IOException */ {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            try {
                tokenizer = new StringTokenizer(
                        reader.readLine());
            } catch(Exception e) {e.printStackTrace();}
        }
        return tokenizer.nextToken();
    }

    static int nextInt() {
        return Integer.parseInt( next() );
    }

    static long nextLong(){ return (long)nextInt();}

    static double nextDouble() {
        return Double.parseDouble( next() );
    }

}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by Mach on 10.12.2018.
 */
public class round526a {
    public static void main(String[] args) {
        Reader526a r=new Reader526a();
        r.init(System.in);

        int n=r.nextInt();
        long s=r.nextLong();
        int a[]=new int[n];
        int min=Integer.MAX_VALUE;

        long sum=0;

        for(int i=0; i<n; i++) {
            a[i]=r.nextInt();
            if (a[i]<min) min=a[i];
            sum=sum+a[i];
        }

        long res=-1;
        if (s<=(sum-(long)min*n)) {System.out.println(min); return;}
        if (s>(sum)) {System.out.println(res); return;}
        res=(sum-s)/(long)n;

        System.out.println(res);

        // 980'103'855'476

    }
}

class Reader526a {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() /* throws IOException */ {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            try {
                tokenizer = new StringTokenizer(
                        reader.readLine());
            } catch(Exception e) {e.printStackTrace();}
        }
        return tokenizer.nextToken();
    }

    static int nextInt() {
        return Integer.parseInt( next() );
    }

    static long nextLong(){ return Long.parseLong(next());}

    static double nextDouble() {
        return Double.parseDouble( next() );
    }

}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by Mach on 10.12.2018.
 */
public class round526a {
    public static void main(String[] args) {
        Reader526a r=new Reader526a();
        r.init(System.in);

        int n=r.nextInt();
        int s=r.nextInt();
        int a[]=new int[n];
        int min=1000000001;
        int sum=0;
        for(int i=0; i<n; i++) {
            a[i]=r.nextInt();
            if (a[i]<min) min=a[i];
            sum=sum+a[i];
        }

        int res=-1;
        if (s<=(sum-min*n)) {System.out.println(min); return;}
        if (s>(sum)) {System.out.println(res); return;}
        res=(sum-s)/n;
        System.out.println(res);

    }
}

class Reader526a {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() /* throws IOException */ {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            try {
                tokenizer = new StringTokenizer(
                        reader.readLine());
            } catch(Exception e) {e.printStackTrace();}
        }
        return tokenizer.nextToken();
    }

    static int nextInt() {
        return Integer.parseInt( next() );
    }

    static long nextLong(){ return (long)nextInt();}

    static double nextDouble() {
        return Double.parseDouble( next() );
    }

}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by Mach on 10.12.2018.
 */
public class round526a {
    public static void main(String[] args) {
        Reader526a r=new Reader526a();
        r.init(System.in);

        int n=r.nextInt();
        long s=r.nextLong();
        int a[]=new int[n];
        int min=Integer.MAX_VALUE;

        long sum=0;
        for(int i=0; i<n; i++) {
            a[i]=r.nextInt();
            if (a[i]<min) min=a[i];
            sum=sum+a[i];
        }

        long res=-1;
        if (s<=(sum-min*n)) {System.out.println(min); return;}
        if (s>(sum)) {System.out.println(res); return;}
        res=(sum-s)/(long)n;

        System.out.println(res);

    }
}

class Reader526a {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() /* throws IOException */ {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            try {
                tokenizer = new StringTokenizer(
                        reader.readLine());
            } catch(Exception e) {e.printStackTrace();}
        }
        return tokenizer.nextToken();
    }

    static int nextInt() {
        return Integer.parseInt( next() );
    }

    static long nextLong(){ return (long)nextInt();}

    static double nextDouble() {
        return Double.parseDouble( next() );
    }

}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by Mach on 10.12.2018.
 */
public class round526a {
    public static void main(String[] args) {
        Reader526a r=new Reader526a();
        r.init(System.in);

        int n=r.nextInt();
        long s=r.nextLong();
        int a[]=new int[n];
        int min=Integer.MAX_VALUE;

        long sum=0;
        for(int i=0; i<n; i++) {
            a[i]=r.nextInt();
            if (a[i]<min) min=a[i];
            sum=sum+a[i];
        }

        long res=-1;
        if (s<=(sum-min*n)) {System.out.println(min); return;}
        if (s>(sum)) {System.out.println(res); return;}
        res=(sum-s)/(long)n;

        System.out.println(res);

    }
}

class Reader526a {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() /* throws IOException */ {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            try {
                tokenizer = new StringTokenizer(
                        reader.readLine());
            } catch(Exception e) {e.printStackTrace();}
        }
        return tokenizer.nextToken();
    }

    static int nextInt() {
        return Integer.parseInt( next() );
    }

    static long nextLong(){ return Long.parseLong(next());}

    static double nextDouble() {
        return Double.parseDouble( next() );
    }

}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Spoj {

    public static void main(String[] arg) {
        final Scanner scanner = new Scanner(System.in);
        long n = scanner.nextLong();
        long s = scanner.nextLong();
        long[] arr = new long[(int)n];
        long sum = 0;
        for(int i=1;i<=n;i++){
            arr[i-1] = scanner.nextLong();
            sum += arr[i-1];
        }
        Arrays.sort(arr);
        long cnt = 0;
        for(int i=1;i<n; i++) {
            cnt += arr[i] - arr[0];
        }
        if(cnt < s && sum >= s) {
            long rem = s - cnt;
            long dec = (rem + n -1)/n;
            arr[0] -= dec;
            cnt = s;
        }
        if(cnt>=s) {
            System.out.println(arr[0]);
        } else {
            System.out.println(-1);
        }
    }
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Spoj {

    public static void main(String[] arg) {
        final Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int s = scanner.nextInt();
        int[] arr = new int[n];
        for(int i=1;i<=n;i++){
            arr[i-1] = scanner.nextInt();
        }
        Arrays.sort(arr);
        int cnt = 0;
        for(int i=1;i<n; i++) {
            cnt += arr[i] - arr[0];
        }
        while(arr[0] > 0 && cnt < s) {
            cnt += n;
            arr[0]--;
        }
        if(cnt>=s) {
            System.out.println(arr[0]);
        } else {
            System.out.println(-1);
        }

    }
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Spoj {

    public static void main(String[] arg) {
        final Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int s = scanner.nextInt();
        int[] arr = new int[n];
        int sum = 0;
        for(int i=1;i<=n;i++){
            arr[i-1] = scanner.nextInt();
            sum += arr[i-1];
        }
        Arrays.sort(arr);
        int cnt = 0;
        for(int i=1;i<n; i++) {
            cnt += arr[i] - arr[0];
        }
        if(cnt < s && sum >= s) {
            int rem = s - cnt;
            //System.out.println("rem = " + rem);
            int dec = (rem + n -1)/n;
            //System.out.println("dec = " + dec);
            arr[0] -= dec;
            cnt = s;
        }
        if(cnt>=s) {
            System.out.println(arr[0]);
        } else {
            System.out.println(-1);
        }
    }
}


import java.util.*;
import java.io.*;
import java.math.*;

public class Prg4 {

    PrintWriter pw = new PrintWriter(System.out);
    Random rnd = new Random();
    int a;

    void run(){
        int a = ni();
        long s = nl(), all=0;
        long[] m = new long[a], sum = new long[a];
        for(int q=0; q<a; q++){
            m[q] = nl();
            all+=m[q];
        }
        PyraSort.sort(m);
        sum[a-1] = m[a-1];
        for(int q=a-2; q>=0; q--) sum[q] = sum[q+1]+m[q];

        long o = 0;
        if(all<s) o = -1;
        else{
            long l = -1, r = Integer.MAX_VALUE;
            for(; l+1!=r;){
                long mid = (l+r)/2;
                int p  = Arrays.binarySearch(m, mid);
                if(p<0) p = -p-1;
                if(p>=a){
                    r = mid;
                    continue;
                }
                p = left(m, p);
                if(sum[p]-mid*(a-p)>=s) l = mid;
                else r = mid;
            }
            o = r-1;
        }
        pw.print(Math.min(o, m[0]));
        pw.flush();
    }

    int left(long[] m, int p){
        if(p==0 || m[p-1]!=m[p]) return p;
        if(m[0]==m[p]) return 0;
        long c = m[p];
        int l=0, r = p;
        for(; !(m[p]==c && m[p-1]!=c);){
            p = (r+l)/2;
            if(m[p]==c) r=p;
            else l = p;
        }
        return p;
    }

    static class PyraSort {

        private static int heapSize;

        public static void sort(long[] a) {
            buildHeap(a);
            while (heapSize > 1) {
                swap(a, 0, heapSize - 1);
                heapSize--;
                heapify(a, 0);
            }
        }

        private static void buildHeap(long[] a) {
            heapSize = a.length;
            for (int i = a.length / 2; i >= 0; i--) {
                heapify(a, i);
            }
        }

        private static void heapify(long[] a, int i) {
            int l = 2 * i + 2;
            int r = 2 * i + 1;
            int largest = i;
            if (l < heapSize && a[i] < a[l]) {
                largest = l;
            }
            if (r < heapSize && a[largest] < a[r]) {
                largest = r;
            }
            if (i != largest) {
                swap(a, i, largest);
                heapify(a, largest);
            }
        }

        private static void swap(long[] a, int i, int j) {
            a[i] ^= a[j] ^= a[i];
            a[j] ^= a[i];
        }
    }

    public static void main(String[] args) {
        new Prg4().run();
    }

    InputStream is = System.in;
    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte()
    {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns()
    {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private String nline(){
        int b = readByte();
        StringBuilder sb = new StringBuilder();
        while (b!=10) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n)
    {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m)
    {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n)
    {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni()
    {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl()
    {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
}


import java.util.*;
import java.io.*;
import java.math.*;

public class Prg4 {

    PrintWriter pw = new PrintWriter(System.out);
    Random rnd = new Random();
    int a;

    void run(){
        int a = ni();
        long s = nl(), all=0;
        long[] m = new long[a], sum = new long[a];
        for(int q=0; q<a; q++){
            m[q] = nl();
            all+=m[q];
        }
        PyraSort.sort(m);
        sum[a-1] = m[a-1];
        for(int q=a-2; q>=0; q--){
            sum[q] = sum[q+1]+m[q];
        }
        long  o =0;
        if(all<s) o = -1;
        else{
            long l = 0, r = Integer.MAX_VALUE;
            for(; l+1!=r;){
                long mid = (l+r)/2;
                int p  = Arrays.binarySearch(m, mid);
                if(p<0) p = -p-1;
                if(p>=a){
                    r = mid;
                    continue;
                }
                p = left(m, p);
                if(sum[p]-mid*(a-p)>=s) l = mid;
                else r = mid;
            }
            o = r-1;
        }
        pw.print(o);
        pw.flush();
    }

    int left(long[] m, int p){
        if(p==0 || m[p-1]!=m[p]) return p;
        if(m[0]==m[p]) return 0;
        long c = m[p];
        int l=0, r = p;
        for(; !(m[p]==c && m[p-1]!=c);){
            p = (r+l)/2;
            if(m[p]==c) r=p;
            else l = p;
        }
        return p;
    }

    static class PyraSort {

        private static int heapSize;

        public static void sort(long[] a) {
            buildHeap(a);
            while (heapSize > 1) {
                swap(a, 0, heapSize - 1);
                heapSize--;
                heapify(a, 0);
            }
        }

        private static void buildHeap(long[] a) {
            heapSize = a.length;
            for (int i = a.length / 2; i >= 0; i--) {
                heapify(a, i);
            }
        }

        private static void heapify(long[] a, int i) {
            int l = 2 * i + 2;
            int r = 2 * i + 1;
            int largest = i;
            if (l < heapSize && a[i] < a[l]) {
                largest = l;
            }
            if (r < heapSize && a[largest] < a[r]) {
                largest = r;
            }
            if (i != largest) {
                swap(a, i, largest);
                heapify(a, largest);
            }
        }

        private static void swap(long[] a, int i, int j) {
            a[i] ^= a[j] ^= a[i];
            a[j] ^= a[i];
        }
    }

    public static void main(String[] args) {
        new Prg4().run();
    }

    InputStream is = System.in;
    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte()
    {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns()
    {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private String nline(){
        int b = readByte();
        StringBuilder sb = new StringBuilder();
        while (b!=10) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n)
    {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m)
    {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n)
    {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni()
    {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl()
    {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
}


import java.util.*;
import java.io.*;
import java.math.*;

public class Prg4 {

    PrintWriter pw = new PrintWriter(System.out);
    Random rnd = new Random();
    int a;

    void run(){
        int a = ni();
        long s = nl(), all=0;
        long[] m = new long[a], sum = new long[a];
        for(int q=0; q<a; q++){
            m[q] = nl();
            all+=m[q];
        }
        PyraSort.sort(m);
        sum[a-1] = m[a-1];
        for(int q=a-2; q>=0; q--) sum[q] = sum[q+1]+m[q];

        long o = 0;
        if(all<s) o = -1;
        else{
            long l = 0, r = Integer.MAX_VALUE;
            for(; l+1!=r;){
                long mid = (l+r)/2;
                int p  = Arrays.binarySearch(m, mid);
                if(p<0) p = -p-1;
                if(p>=a){
                    r = mid;
                    continue;
                }
                p = left(m, p);
                if(sum[p]-mid*(a-p)>=s) l = mid;
                else r = mid;
            }
            o = r-1;
        }
        pw.print(Math.min(o, m[0]));
        pw.flush();
    }

    int left(long[] m, int p){
        if(p==0 || m[p-1]!=m[p]) return p;
        if(m[0]==m[p]) return 0;
        long c = m[p];
        int l=0, r = p;
        for(; !(m[p]==c && m[p-1]!=c);){
            p = (r+l)/2;
            if(m[p]==c) r=p;
            else l = p;
        }
        return p;
    }

    static class PyraSort {

        private static int heapSize;

        public static void sort(long[] a) {
            buildHeap(a);
            while (heapSize > 1) {
                swap(a, 0, heapSize - 1);
                heapSize--;
                heapify(a, 0);
            }
        }

        private static void buildHeap(long[] a) {
            heapSize = a.length;
            for (int i = a.length / 2; i >= 0; i--) {
                heapify(a, i);
            }
        }

        private static void heapify(long[] a, int i) {
            int l = 2 * i + 2;
            int r = 2 * i + 1;
            int largest = i;
            if (l < heapSize && a[i] < a[l]) {
                largest = l;
            }
            if (r < heapSize && a[largest] < a[r]) {
                largest = r;
            }
            if (i != largest) {
                swap(a, i, largest);
                heapify(a, largest);
            }
        }

        private static void swap(long[] a, int i, int j) {
            a[i] ^= a[j] ^= a[i];
            a[j] ^= a[i];
        }
    }

    public static void main(String[] args) {
        new Prg4().run();
    }

    InputStream is = System.in;
    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte()
    {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns()
    {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private String nline(){
        int b = readByte();
        StringBuilder sb = new StringBuilder();
        while (b!=10) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n)
    {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m)
    {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n)
    {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni()
    {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl()
    {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
}


import java.util.*;
import java.io.*;
import java.math.*;

public class Prg4 {

    PrintWriter pw = new PrintWriter(System.out);
    Random rnd = new Random();
    int a;

    void run(){
        int a = ni();
        long s = nl(), all=0;
        long[] m = new long[a], sum = new long[a];
        for(int q=0; q<a; q++){
            m[q] = nl();
            all+=m[q];
        }
        PyraSort.sort(m);
        sum[a-1] = m[a-1];
        for(int q=a-2; q>=0; q--) sum[q] = sum[q+1]+m[q];

        long o = 0;
        if(all<s) o = -1;
        else{
            long l = -1, r = Integer.MAX_VALUE;
            for(; l+1!=r;){
                long mid = (l+r)/2;
                int p  = Arrays.binarySearch(m, mid);
                if(p<0) p = -p-1;
                if(p>=a){
                    r = mid;
                    continue;
                }
                p = left(m, p);
                if(sum[p]-mid*(a-p)>=s) l = mid;
                else r = mid;
            }
            o = r;
        }
        pw.print(Math.min(o, m[0]));
        pw.flush();
    }

    int left(long[] m, int p){
        if(p==0 || m[p-1]!=m[p]) return p;
        if(m[0]==m[p]) return 0;
        long c = m[p];
        int l=0, r = p;
        for(; !(m[p]==c && m[p-1]!=c);){
            p = (r+l)/2;
            if(m[p]==c) r=p;
            else l = p;
        }
        return p;
    }

    static class PyraSort {

        private static int heapSize;

        public static void sort(long[] a) {
            buildHeap(a);
            while (heapSize > 1) {
                swap(a, 0, heapSize - 1);
                heapSize--;
                heapify(a, 0);
            }
        }

        private static void buildHeap(long[] a) {
            heapSize = a.length;
            for (int i = a.length / 2; i >= 0; i--) {
                heapify(a, i);
            }
        }

        private static void heapify(long[] a, int i) {
            int l = 2 * i + 2;
            int r = 2 * i + 1;
            int largest = i;
            if (l < heapSize && a[i] < a[l]) {
                largest = l;
            }
            if (r < heapSize && a[largest] < a[r]) {
                largest = r;
            }
            if (i != largest) {
                swap(a, i, largest);
                heapify(a, largest);
            }
        }

        private static void swap(long[] a, int i, int j) {
            a[i] ^= a[j] ^= a[i];
            a[j] ^= a[i];
        }
    }

    public static void main(String[] args) {
        new Prg4().run();
    }

    InputStream is = System.in;
    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte()
    {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns()
    {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private String nline(){
        int b = readByte();
        StringBuilder sb = new StringBuilder();
        while (b!=10) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n)
    {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m)
    {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n)
    {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni()
    {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl()
    {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class gr1 {

    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }

        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
    }

    static class card{
        long a;
        int cnt;
        int i;
        public card(long a,int cnt,int i)
        {
            this.a=a;
            this.cnt=cnt;
            this.i=i;
        }
    }

    static class ascend implements Comparator<pair>
    {
        public int compare(pair o1,pair o2)
        {
            if(o1.b!=o2.b)
                return (int)(o1.b-o2.b);
            else
                return (int)(o1.a-o2.a);
        }
    }

    /*static class descend implements Comparator<pair>
    {
    public int compare(pair o1,pair o2)
    {
    if(o1.a!=o2.a){
    return (o1.a-o2.a)*-1;
    } else {
    return (o1.b-o2.b);
    }
    }
    }*/

    static class extra
    {

        static void shuffle(long a[])
        {
            List<Long> l=new ArrayList<>();
            for(int i=0;i<a.length;i++)
                l.add(a[i]);
            Collections.shuffle(l);
            for(int i=0;i<a.length;i++)
                a[i]=l.get(i);
        }

        static long gcd(long a,long b)
        {
            if(b==0)
                return a;
            else
                return gcd(b,a%b);
        }

        static boolean valid(int i,int j,int r,int c)
        {
            if(i>=0 && i<r && j>=0 && j<c)
                return true;
            else
                return false;
        }

        static boolean v[]=new boolean[100001];
        static List<Integer> l=new ArrayList<>();
        static int t;
        static void seive()
        {
            for(int i=2;i<100001;i++)
            {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            }
        }

        static int binary(pair a[],int val,int n)
        {
            int mid=0,l=0,r=n-1,ans=0;
            while(l<=r)
            {
                mid=(l+r)>>1;
                if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            }
            return (ans);
        }
    }

    static class pair{
        long a;
        int b;
        public pair(long a,int n)
        {
            this.a=a;
            this.b=n;
        }
    }
    static InputReader sc=new InputReader(System.in);
    static PrintWriter out=new PrintWriter(System.out);
    public static void main(String[] args) {
        solver s=new solver();
        int t=1;
        while(t>0)
        {
            s.solve();
            t--;
        }
    }
    static class solver
    {
        void solve()
        {
            int n=sc.nextInt();
            long s=sc.nextLong();
            long v[]=new long[n];
            long min=Long.MAX_VALUE;
            long sum=0;
            for(int i=0;i<n;i++)
            {
                v[i]=sc.nextLong();
                sum+=v[i];
                if(v[i]<min)
                    min=v[i];
            }
            if(s>sum)
                System.out.println(-1);
            else
            {
                Arrays.sort(v);
                for(int i=n-1;i>=1;i--)
                {
                    s-=Math.min(v[i]-min,s);
                    if(s==0)
                    {
                        System.out.println(min);
                        System.exit(0);
                    }
                }
                while(s>0)
                {
                    min--;
                    s-=Math.min(s,n-1);
                }
                System.out.println(min);
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class gr1 {

    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }

        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
    }

    static class card{
        long a;
        int cnt;
        int i;
        public card(long a,int cnt,int i)
        {
            this.a=a;
            this.cnt=cnt;
            this.i=i;
        }
    }

    static class ascend implements Comparator<pair>
    {
        public int compare(pair o1,pair o2)
        {
            if(o1.b!=o2.b)
                return (int)(o1.b-o2.b);
            else
                return (int)(o1.a-o2.a);
        }
    }

    /*static class descend implements Comparator<pair>
    {
    public int compare(pair o1,pair o2)
    {
    if(o1.a!=o2.a){
    return (o1.a-o2.a)*-1;
    } else {
    return (o1.b-o2.b);
    }
    }
    }*/

    static class extra
    {

        static void shuffle(long a[])
        {
            List<Long> l=new ArrayList<>();
            for(int i=0;i<a.length;i++)
                l.add(a[i]);
            Collections.shuffle(l);
            for(int i=0;i<a.length;i++)
                a[i]=l.get(i);
        }

        static long gcd(long a,long b)
        {
            if(b==0)
                return a;
            else
                return gcd(b,a%b);
        }

        static boolean valid(int i,int j,int r,int c)
        {
            if(i>=0 && i<r && j>=0 && j<c)
                return true;
            else
                return false;
        }

        static boolean v[]=new boolean[100001];
        static List<Integer> l=new ArrayList<>();
        static int t;
        static void seive()
        {
            for(int i=2;i<100001;i++)
            {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            }
        }

        static int binary(pair a[],int val,int n)
        {
            int mid=0,l=0,r=n-1,ans=0;
            while(l<=r)
            {
                mid=(l+r)>>1;
                if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            }
            return (ans);
        }
    }

    static class pair{
        long a;
        int b;
        public pair(long a,int n)
        {
            this.a=a;
            this.b=n;
        }
    }
    static InputReader sc=new InputReader(System.in);
    static PrintWriter out=new PrintWriter(System.out);
    public static void main(String[] args) {
        solver s=new solver();
        int t=1;
        while(t>0)
        {
            s.solve();
            t--;
        }
    }
    static class solver
    {
        void solve()
        {
            int n=sc.nextInt();
            long s=sc.nextLong();
            long v[]=new long[n];
            long min=Long.MAX_VALUE;
            long sum=0;
            for(int i=0;i<n;i++)
            {
                v[i]=sc.nextLong();
                sum+=v[i];
                if(v[i]<min)
                    min=v[i];
            }
            if(s>sum)
                System.out.println(-1);
            else
            {
                new extra().shuffle(v);
                Arrays.sort(v);
                for(int i=n-1;i>=1;i--)
                {
                    s-=Math.min(v[i]-min,s);
                    if(s==0)
                    {
                        System.out.println(min);
                        System.exit(0);
                    }
                }
                long d=s%n;
                if(d==0)
                min=0;
                else
                {
                    min-=(s/n)+1;
                }
                System.out.println(min);
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class gr1 {

    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }

        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
    }

    static class card{
        long a;
        int cnt;
        int i;
        public card(long a,int cnt,int i)
        {
            this.a=a;
            this.cnt=cnt;
            this.i=i;
        }
    }

    static class ascend implements Comparator<pair>
    {
        public int compare(pair o1,pair o2)
        {
            if(o1.b!=o2.b)
                return (int)(o1.b-o2.b);
            else
                return (int)(o1.a-o2.a);
        }
    }

    /*static class descend implements Comparator<pair>
    {
    public int compare(pair o1,pair o2)
    {
    if(o1.a!=o2.a){
    return (o1.a-o2.a)*-1;
    } else {
    return (o1.b-o2.b);
    }
    }
    }*/

    static class extra
    {

        static void shuffle(long a[])
        {
            List<Long> l=new ArrayList<>();
            for(int i=0;i<a.length;i++)
                l.add(a[i]);
            Collections.shuffle(l);
            for(int i=0;i<a.length;i++)
                a[i]=l.get(i);
        }

        static long gcd(long a,long b)
        {
            if(b==0)
                return a;
            else
                return gcd(b,a%b);
        }

        static boolean valid(int i,int j,int r,int c)
        {
            if(i>=0 && i<r && j>=0 && j<c)
                return true;
            else
                return false;
        }

        static boolean v[]=new boolean[100001];
        static List<Integer> l=new ArrayList<>();
        static int t;
        static void seive()
        {
            for(int i=2;i<100001;i++)
            {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            }
        }

        static int binary(pair a[],int val,int n)
        {
            int mid=0,l=0,r=n-1,ans=0;
            while(l<=r)
            {
                mid=(l+r)>>1;
                if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            }
            return (ans);
        }
    }

    static class pair{
        long a;
        int b;
        public pair(long a,int n)
        {
            this.a=a;
            this.b=n;
        }
    }
    static InputReader sc=new InputReader(System.in);
    static PrintWriter out=new PrintWriter(System.out);
    public static void main(String[] args) {
        solver s=new solver();
        int t=1;
        while(t>0)
        {
            s.solve();
            t--;
        }
    }
    static class solver
    {
        void solve()
        {
            int n=sc.nextInt();
            long s=sc.nextLong();
            long v[]=new long[n];
            long min=Long.MAX_VALUE;
            long sum=0;
            for(int i=0;i<n;i++)
            {
                v[i]=sc.nextLong();
                sum+=v[i];
                if(v[i]<min)
                    min=v[i];
            }
            if(s>sum)
                System.out.println(-1);
            else
            {
                new extra().shuffle(v);
                Arrays.sort(v);
                for(int i=n-1;i>=1;i--)
                {
                    s-=Math.min(v[i]-min,s);
                    if(s==0)
                    {
                        System.out.println(min);
                        System.exit(0);
                    }
                }
                min-=(s/n)+((s%n==0)?0:1);
                System.out.println(min);
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class kvass {

	public static void main(String[] args) throws IOException
	{
		BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(read.readLine());
		int n= Integer.parseInt(st.nextToken());
		int s= Integer.parseInt(st.nextToken());
		st = new StringTokenizer(read.readLine());
		long total=Integer.parseInt(st.nextToken());
		int min = (int)total, x;
		for (int i=1; i<n; i++)
		{
			x=Integer.parseInt(st.nextToken());
			total+=x;
			if (min>x)
				min=x;
		}
		if (total<s)
			System.out.println(-1);
		else
		{
			if (min>=(total-s)/n)
				System.out.println((total-s)/n);
			else
				System.out.println(min);
		}

	}

}


import java.util.Scanner;

public class kvass {

	public static void main(String[] args)
	{
		Scanner sc= new Scanner(System.in);
		int n = sc.nextInt();
		int s = sc.nextInt();
		int total=sc.nextInt(), x;
		int min=total;
		for (int i=1; i<n; i++)
		{
			x=sc.nextInt();
			total+=x;
			if (min>x)
				min=x;
		}
		if (total<s)
			System.out.println(-1);
		else
		{
			if (min>=(total-s)/n)
				System.out.println((total-s)/n);
			else
				System.out.println(min);
		}
		sc.close();
	}

}


import java.util.Scanner;

public class kvass {

	public static void main(String[] args)
	{
		Scanner sc= new Scanner(System.in);
		long n = sc.nextLong();
		long s = sc.nextLong();
		long total=sc.nextLong();
		long min = total, x;
		for (int i=1; i<n; i++)
		{
			x=sc.nextLong();
			total+=x;
			if (min>x)
				min=x;
		}
		if (total<s)
			System.out.println(-1);
		else
		{
			if (min>=(total-s)/n)
				System.out.println((total-s)/n);
			else
				System.out.println(min);
		}
		sc.close();
	}

}


import java.util.Scanner;

public class kvass {

	public static void main(String[] args)
	{
		Scanner sc= new Scanner(System.in);
		int n = sc.nextInt();
		int s = sc.nextInt();
		long total=sc.nextInt();
		int min = (int)total, x;
		for (int i=1; i<n; i++)
		{
			x=sc.nextInt();
			total+=x;
			if (min>x)
				min=x;
		}
		if (total<s)
			System.out.println(-1);
		else
		{
			if (min>=(total-s)/n)
				System.out.println((total-s)/n);
			else
				System.out.println(min);
		}
		sc.close();
	}

}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long s = in.nextLong();
        long number;
        long sum = 0;
        long min = Long.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            number = in.nextLong();
            sum += number;
            if (number < min) {
                min = number;
            }
        }
        long d = sum - n*min;
        if (sum < s) {
            System.out.println(-1);
        } else if(sum == s) {
            System.out.println(0);
        } else {
            s -= d;
            if (s < d) {
                System.out.println(min);
            } else if (s % n == 0) {
                System.out.println(min - s/n);
            } else {
                System.out.println(min - s/n - 1);
            }
        }
    }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long s = in.nextLong();
        int number;
        long sum = 0;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            number = in.nextInt();
            sum += number;
            if (number < min) {
                min = number;
            }
        }
        long d = sum - n*min;
        if (sum < s) {
            System.out.println(-1);
        } else if(sum == s) {
            System.out.println(0);
        } else {
            if (s < d) {
                System.out.println(min);
            }
            s -= d;
            if (s % n == 0) {
                System.out.println(min - s/n);
            } else {
                System.out.println(min - s/n - 1);
            }
        }
    }
}