#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
long long a[N],n,m,k,b,c,ans,maxx;
bool cheek(int x)
{
long long cnt=0;
for(int i=1;i<=n;i++)
{
cnt+=a[i]-x;
}
if(cnt>=m) return true;
return false;
}
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
long long l=1,r=2e9,ans=0;
while(l<=r)
{
long long mid=(l+r)/2;
if(cheek(mid))
{
ans=mid;
l=mid+1;
}
else r=mid-1;
}
cout<<ans;
return 0;
}