二分即可~
#include <bits/stdc++.h>
using namespace std;
int n, k, a[200010];
int check(int x) {
long long ans = 0;
for (int i = n + 1 >> 1;i <= n; i++)
if (a[i] < x) ans += x - a[i];
else break;
return ans <= k;
}
int main() {
scanf("%d%d", &n, &k);
for (int i = 1;i <= n; i++) scanf("%d", &a[i]);
int l = 0, r = 2e9;
sort (a + 1, a + 1 + n);
while (l < r) {
int mid = 1ll + l + r >> 1;
if (check(mid)) l = mid;
else r = mid - 1;
}
printf("%d", r);
return 0;
}