#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;

int main()
{
    int n, k;
    freopen("repair.in", "r", stdin);
    freopen("repair.out", "w", stdout);
    scanf("%d%d", &n, &k);
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    sort(a.begin(), a.end());
    int i = 0;
    long long cur_sum = 0;
    while (i < n && (long long)i * a[i] - cur_sum <= k)
    {
        //fprintf(stderr, "%d * %d - %d <= %d\n", i, a[i], cur_sum, k);
        cur_sum += a[i];
        i++;
    }
    cout << a[i - 1] + (k - (long long)i * a[i - 1] + cur_sum) / i  << endl;
    return 0;
}