#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n,m;
long long lan[10005];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for(int i=0; i<n; i++) {
cin >> lan[i];
}
long long st,en;
st=1;
en=*max_element(lan,lan+n);
long long res=0;
while(st<=en) {
long long mid=(st+en)/2;
long long total=0;
for(int i=0; i<n; i++) {
if(lan[i]>=mid) total += lan[i]/mid;
}
if(total>=m) {
res=mid;
st=mid+1;
}
else en=mid-1;
}
cout << res;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: