30pts
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
int n,k,a[N];
bool check(int s)
{
long long sum=0;
for(int i=1; i<=n; i++)
if(a[i]-s<1)sum+=1+s-a[i];
return sum<=1ll*s*k;
}
signed main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>n>>k;
for(int i=1; i<=n; i++)
cin>>a[i];
int L=0,R=0x3f3f3f3f;
while(L<R)
{
int mid=(L+R)>>1;
if(check(mid))L=mid;
else R=mid-1;
}
cout<<L;
return 0;
}