#include <bits/stdc++.h>
using namespace std;
long long n, s, a[1001];
int main() {
  while (cin >> n >> s) {
    long long maxa = 0, sum = 0, mina = 0x3f3f3f3f;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      maxa = max(a[i], maxa);
      mina = min(mina, a[i]);
      sum += a[i];
    }
    long long l = 0, r = maxa;
    while (l + 1 < r) {
      long long mid = (l + r) / 2;
      if (sum - mid * n >= s)
        l = mid;
      else
        r = mid;
    }
    while (r >= 0 && sum - r * n < s) {
      r--;
    }
    cout << min(r, mina) << endl;
  }
  return 0;
}
