#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
long long v[maxn];
int main() {
  long long n, s;
  scanf("%lld%lld", &n, &s);
  long long sum = 0, minn = 1e9 + 7, x;
  for (long long i = 0; i < n; i++)
    scanf("%lld", &x), sum += x, minn = min(minn, x);
  if (sum < s)
    printf("-1\n");
  else {
    long long ans = (sum - s) / n;
    printf("%d\n", min(minn, ans));
  }
}
