#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, sum, sum1, ans, sub, arr[1000000];
int main() {
  scanf("%lld %lld", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
    sum = sum + arr[i];
  }
  if (sum < m) {
    printf("-1\n");
  } else if (sum == m) {
    printf("0\n");
  } else {
    sort(arr, arr + n);
    sum1 = 0;
    for (i = 1; i < n; i++) {
      sum1 = sum1 + (abs(arr[i] - arr[0]));
    }
    if (sum1 >= m) {
      printf("%lld", arr[0]);
    } else {
      sum1 = m - sum1;
      if (sum1 % n == 0) {
        sub = sum1 / n;
      } else {
        sub = (sum1 / n) + 1;
      }
      ans = arr[0] - sub;
      printf("%lld\n", ans);
    }
  }
}
