#include <bits/stdc++.h>

int main() {
    freopen("repair.in", "r", stdin);
    freopen("repair.out", "w", stdout);
    int n, k;
    scanf("%d%d", &n, &k);
    std::vector <int> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    std::sort(a.begin(), a.end());
    for (int i = 0; i < n - 1; i++) {
        long long needToAdd = (i + 1) * 1LL * (a[i + 1] - a[i]);
        if (k < needToAdd) {
            printf("%d\n", a[i] + k / (i + 1));
            return 0;
        }
        k -= needToAdd;
    }
    printf("%d\n", a[n - 1] + k / n);
    return 0;
}