#include <bits/stdc++.h>   using namespace std;   class Timer {     clock_t start;     string name;       public:     Timer() {       name =   ;       start = clock();     }     Timer(string s) {       name = s;       start = clock();     }     ~Timer() {       fprintf(stderr,  %s: %.3gs n , name.c_str(),               1.0 * (clock() - start) / CLOCKS_PER_SEC);     }   };   const double EPS = 1e-9;   const long double PI = acos(-1.0L);   template <typename dtype>   inline dtype sq(dtype a) {     return a * a;   }   template <typename dtype1, typename dtype2>   inline pair<dtype1, dtype2> mp(dtype1 a, dtype2 b) {     return make_pair(a, b);   }   template <typename dtype1, typename dtype2>   inline dtype1 safeMod(dtype1 a, dtype2 m) {     return (a % m + m) % m;   }   template <typename dtype1, typename dtype2>   inline bool isEq(dtype1 a, dtype2 b) {     return abs(a - b) < EPS;   }   template <typename dtype1, typename dtype2, typename dtype3>   inline bool isEq(dtype1 a, dtype2 b, dtype3 eps) {     return abs(a - b) < eps;   }   template <typename dtype>   inline dtype toRad(dtype deg) {     return deg * PI / 180.0;   }   template <typename dtype>   inline dtype toDeg(dtype rad) {     return rad * 180.0 / PI;   }   template <typename dtype>   inline bool isKthBitOn(dtype n, int k) {     assert(n <= numeric_limits<dtype>::max());     assert(k <= numeric_limits<dtype>::digits);     dtype ONE = 1;     return bool((n & (ONE << k)));   }   template <typename dtype>   inline void setKthBit(dtype& n, int k) {     assert(n <= numeric_limits<dtype>::max());     assert(k <= numeric_limits<dtype>::digits);     dtype ONE = 1;     n = (n | (ONE << k));   }   const int oo = 0x3f3f3f3f;   const int MAX = 200010;   const int MOD = 1000000007;   const int precision = 10;   int main(int argc, char* argv[]) {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long n, s, sum = 0;     long long ara[MAX];     cin >> n >> s;     long long mini = INT_MAX;     for (int i = 0; i < n; i++) {       cin >> ara[i];       sum += ara[i];       mini = min(mini, ara[i]);     }     if (sum < s)       cout << -1;     else {       sum = 0;       for (int i = 0; i < n; i++) {         sum += ara[i] - mini;       }       s -= sum;       s = max(s, 0LL);       mini -= s / n + (s % n != 0);       cout << mini << endl;     }     return 0;   }   