#include <bits/stdc++.h>
using namespace std;
long long binarySearch(long long arr[], long long l, long long r, long long x) {
  if (r >= l) {
    long long mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);
    if (arr[mid] < x) return binarySearch(arr, mid + 1, r, x);
  }
  return -1;
}
long long fact(long long n) {
  if (n == 0 || n == 1)
    return 1;
  else
    return n * fact(n - 1);
}
long long ncr(long long n, long long r) {
  if (r < 0 || r > n) return 0;
  if (r == 0)
    return 1;
  else
    return (n * ncr(n - 1, r - 1)) / r;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6) {
    if (n % i == 0 || n % (i + 2) == 0) {
      return false;
    }
  }
  return true;
}
bool isPowerOfTwo(long long n) {
  if (n == 0) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
long long mostFrequent(long long arr[], long long n) {
  unordered_map<long long, long long> hash;
  for (long long i = 0; i < n; i++) hash[arr[i]]++;
  long long max_count = 0, res = -1;
  for (auto i : hash) {
    if (max_count < i.second) {
      res = i.first;
      max_count = i.second;
    }
  }
  return max_count;
}
long long countSetBits(long long n) {
  long long count = 0;
  while (n) {
    count += n & 1;
    n >>= 1;
  }
  return count;
}
long long factors(long long n) {
  long long a = 0, z = 1;
  while (n % 2 == 0) {
    a++;
    n >>= 1;
  }
  z *= a + 1;
  for (long long i = 3; i <= sqrt(n); i += 2) {
    a = 0;
    while (n % i == 0) {
      a++;
      n = n / i;
    }
    z *= a + 1;
  }
  if (n > 2) z *= 2;
  return z - 2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  long long testcases = 1;
  while (testcases--) {
    long long n, s, k, a = 0, p = 1000000007;
    cin >> n >> s;
    for (long long i = 0; i < n; i++) {
      cin >> k;
      p = ((k > p) ? p : k);
      a += k;
    }
    if (a < s)
      cout << -1;
    else
      cout << ((p > (a - s) / n) ? (a - s) / n : p);
  }
  return 0;
}
