#include<bits/stdc++.h>
using namespace std;
#define el "\n"
#define vc vector
#define st string
#define un unsigned
#define ll long long
#define mod(n) ((n%mod)+mod)%mod
#define all(d) d.begin(), d.end()
#define rt(x) return void(cout<<x)
#define sums(n) (((un ll)n*(n+1))/2)
#define findd(s,v) (s.find(v)!=s.end())
#define mem(a,v) memset(a, v, sizeof(a))
#define u64 __int128
#define pl pair<ll,ll>
#define sum1 prefix[idx][i]
#define Mod 999999999999999989
void El_Psy_Congroo()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
// freopen("grendizer.in", "r", stdin);
//freopen("test1.txt", "w", stdout);
}
ll freq[1000002],sum[1000002],MaxNum=0;
ll NeededOperations(int x)
{
ll ans=freq[x]*x-sum[x];
for(ll last=x,cur=2*x;cur<=MaxNum;cur+=x,last+=x)
{
ll freq2=freq[cur]-freq[last];
ll sum2=sum[cur]-sum[last];
ans+=cur*freq2-sum2;
}
return ans;
}
int32_t main()
{
ll n,k,Sum=0;
cin>>n>>k;
vc<int>v(n);
for(auto &i:v)
{
cin>>i;
freq[i]++;
sum[i]+=i;
Sum+=i;
if(i>MaxNum)
MaxNum=i;
}
for(int i=1;i<=MaxNum;i++)
{
freq[i]+=freq[i-1];
sum[i]+=sum[i-1];
}
ll ma=1;
for(int i=1;i<=MaxNum;i++)
{
if(NeededOperations(i)<=k)
ma=i;
}
ll w=((k+Sum)/n >=MaxNum)? (k+Sum)/n:0;
ma=max(ma,w);
cout<<ma;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBlbCAiXG4iCiNkZWZpbmUgdmMgdmVjdG9yCiNkZWZpbmUgc3Qgc3RyaW5nCiNkZWZpbmUgdW4gdW5zaWduZWQKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBtb2QobikgKChuJW1vZCkrbW9kKSVtb2QKI2RlZmluZSBhbGwoZCkgZC5iZWdpbigpLCBkLmVuZC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KICAgICAgICBjaW4+Pmk7CgogICAgICAgIGZyZXFbaV0rKzsKICAgICAgICBzdW1baV0rPWk7CiAgICAgICAgU3VtKz1pOwogICAgICAgIGlmKGk+TWF4TnVtKQogICAgICAgICAgICBNYXhOdW09aTsKICAgIH0KICAgIGZvcihpbnQgaT0xO2k8PU1heE51bTtpKyspCiAgICB7CiAgICAgICAgZnJlcVtpXSs9ZnJlcVtpLTFdOwogICAgICAgIHN1bVtpXSs9c3VtW2ktMV07CiAgICB9CiAgICBsbCBtYT0xOwogICAgZm9yKGludCBpPTE7aTw9TWF4TnVtO2krKykKICAgIHsKICAgICAgICBpZihOZWVkZWRPcGVyYXRpb25zKGkpPD1rKQogICAgICAgICAgICBtYT1pOwogICAgfQogICAgbGwgdz0oKGsrU3VtKS9uID49TWF4TnVtKT8gKGsrU3VtKS9uOjA7CgogICAgbWE9bWF4KG1hLHcpOwogICAgY291dDw8bWE7Cn0KCg==