#include <bits/stdc++.h>
using namespace std;
int n;
long long s, sum, mn = 1000ll * 1000ll * 1000ll * 1000ll * 1000ll * 1000ll;
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    mn = min(mn, x);
    sum += x;
  }
  if (sum < s)
    cout << -1 << endl;
  else
    cout << min((sum - s) / (long long)n, mn) << endl;
  return 0;
}
