#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
const int N = 500010;
int arr[N];
int city,box;
bool check(int mid)
{
int sum = 0;
for (int i = 0; i < city; i++)
//最大箱子的容量
sum += ceil(arr[i]*1.0/mid);
return sum<=box;
}
int main()
{
while (scanf("%d%d",&city,&box) != EOF)
{
if (city == -1 && box == -1)
break;
int res = 0;
for (int i = 0; i < city; i++)
{
scanf("%d",&arr[i]);
res = max(res,arr[i]);
}
//如果城市的数目 等于 邮箱的数目
//就一个城市一个邮箱,直接输出最大的
if (city == box)
{
printf("%d
",res);
continue;
}
int l = 1,r = res;
int flag, sum;
while (l < r)
{
int mid = (l+r)>>1;
if(check(mid))
r=mid;
else
l=mid+1;
}
printf("%d
",r);
}
return 0;
}