#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const int maxn = 500004;
int a[maxn];
int n, box;
int main()
{
while(scanf("%d%d", &n, &box)!=EOF)
{
int res = 0;
if(n==-1 && box==-1) break;
for(int i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
res = max(res, a[i]);
}
if(n==box) printf("%d\n", res);
else
{
int l = 1, r = res;
while(l<r)
{
int sum = 0;
int flag = 1;
int mid = (l+r)>>1;
for(int i = 1; i <= n; i++)
{
sum += ceil(a[i]*1.0/mid);
if(sum>box)
flag = 0;
}
if(flag) r = mid;
else l = mid+1;
}
printf("%d\n", r);
}
}
}