#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  while (cin >> n >> m) {
    long long num, sum = 0, minx = 1000000001;
    for (long long i = 0; i < n; i++) {
      cin >> num;
      sum += num;
      if (num < minx) minx = num;
    }
    if (sum < m)
      cout << -1 << endl;
    else if (minx < (sum - m) / n) {
      cout << minx << endl;
    } else
      cout << (sum - m) / n << endl;
  }
}
