#include <bits/stdc++.h>
#include <chrono>
#include <random>
#include <sstream>
#include <string>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=100001;
bool vis[N];
vector <int> adj[N];
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
// ll binaryNum[32];
// void decToBinary(ll n) 
// { 
//     binaryNum[32]={0};
//     int i = 0; 
//     while (n > 0) { 
//         binaryNum[i] = n % 2; 
//         n = n / 2; 
//         i++; 
//     } 
// } 

void solve(){
    ll n,k;
    cin>>n>>k;
    vector<double> a(n);
    rep(i,n){
        cin>>a[i];
    }
    sort(a.begin(),a.end(),greater<double>());
    double sum=0;
    double maxi;
    ll ind=n-1;
    double count=0;
    rep(i,n){
        if(sum/(count+k) >= a[i]){
            maxi=sum/(count+k);
            ind=i-1;
            break;
        }
        sum+=a[i];
        count++;
    }
    // cout<<count<<endl;
    if(ind==n-1){
        maxi=sum/(count+k);
        // maxi = max(maxi,a[0]);
    }
    double ans=0;
    ll done=0;
    ll maxind;
    set<pair<double,double>> st;
    for(ll i=ind;i>=0;i--){
        double temp =  (double)((ll)(a[i]/maxi));
        // ans = max(ans,a[i]/temp);
        // if(i==0){
        //     temp=count+k-done;
        // }
        done+=temp;
        // cout<<temp<<' ';
        // if(done>k+count){
        //     temp=1;
        // }
        


        // cout<<temp<<endl;
        st.insert(mp(a[i]/temp,a[i]));
        if(a[i]/temp > ans){
            ans = a[i]/temp;
            maxind=i;
        }
    }
    int flag=1;
    while(done<count+k){
        flag=0;
        set<pair<double,double>>::iterator it; 
        it = --st.end(); 
        double lar = (*it).second;
        double temp =  (double)((ll)(lar/maxi)) + 1;
        done++; 
        st.erase(it); 
        st.insert(mp(lar/temp,lar));

    }
    if(flag==0){
        set<pair<double,double>>::iterator it; 
        it = --st.end(); 
        ans = (*it).first;
    }
    
    // cout<<maxi<<endl;
    // cout<<(450968417/4785)<<endl;
    if(k<n){
        // ans = max(ans,a[0]);
        if(a[n-1]>ans){
            ans=a[n-1];
        }
    }
    ll ans2 = (ll)ans;
    if(ans-ans2 > 0){
        ans2++;
    }
    cout<<ans2;


}


int main()
{
    // cout<<1<<endl;
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 19660