#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, mn, res, sum;
  cin >> n >> m;
  long long arr[n];
  sum = 0;
  mn = INT_MAX;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    mn = min(arr[i], mn);
    sum += arr[i];
  }
  res = mn;
  if (sum < m) {
    cout << "-1";
    return 0;
  }
  if (sum == 0) {
    cout << "0";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    m = m - (arr[i] - mn);
    if (m <= 0) break;
  }
  if (m > 0) {
    { mn = mn - ((m + n - 1) / n); }
  }
  cout << mn << "\n";
}
