#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
typedef pair< int , int> pii;
typedef pair< long long , long long> pll;
#define intmax 100000000
#define se second
#define fi first
#define MOD 1000000007
#define PI 3.1415926535897932385
const long long Nmax= 1000000 ;
bool ispossible( ll arr[ ] , ll k, ll n, ll h) {
ll temp= 0 ;
for ( int i= 0 ; i< n; i++) {
temp+= ceil( ( ( long double) arr[ i] ) /k) ;
}
if ( temp<= h)
return true;
return false;
}
int main( ) {
ios_base::sync_with_stdio( false) ;
cin.tie ( NULL) ;
cout.tie ( NULL) ;
int t;
cin>> t;
while ( t--) {
ll n, h;
cin>> n>> h;
ll arr[ n] ;
ll sum = 0 ;
ll alpha= 0 ;
for ( int i= 0 ; i< n; i++) {
cin>> arr[ i] ;
sum += arr[ i] ;
alpha= max ( alpha, arr[ i] ) ;
}
ll ans= sum +100 ;
ll l= 1 ;
ll r= alpha;
while ( l<= r) {
ll mid= ( l+r) /2ll;
if ( ispossible( arr, mid, n, h) ) {
ans= min ( mid, ans) ;
r= mid-1 ;
}
else l= mid+1 ;
}
cout<< ans<< endl;
}
return 0 ;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBsZCBsb25nIGRvdWJsZQp0eXBlZGVmIHBhaXI8aW50LGludD4gcGlpOwp0eXBlZGVmIHBhaXI8bG9uZyBsb25nICxsb25nIGxvbmc+cGxsOwojZGVmaW5lIGludG1heCAxMDAwMDAwMDAKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBmaSBmaXJzdAojZGVmaW5lIE1PRCAxMDAwMDAwMDA3CiNkZWZpbmUgUEkgMy4xNDE1OTI2NTM1ODk3OTMyMzg1CmNvbnN0IGxvbmcgbG9uZyBObWF4PTEwMDAwMDA7Cgpib29sIGlzcG9zc2libGUobGwgYXJyW10sbGwgayxsbCBuLGxsIGgpewogICAgbGwgdGVtcD0wOwogICAgZm9yKGludCBpPTA7aTxuO2krKyl7CiAgICAgICAgdGVtcCs9Y2VpbCgoKGxvbmcgZG91YmxlKWFycltpXSkvayk7CiAgICB9CiAgICBpZih0ZW1wPD1oKQogICAgICAgIHJldHVybiB0cnVlOwogICAgcmV0dXJuIGZhbHNlOwp9CgppbnQgbWFpbigpIHsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZShOVUxMKTsKICAgIGNvdXQudGllKE5VTEwpOwogICAgCiAgICBpbnQgdDsKICAgIGNpbj4+dDsKICAgIHdoaWxlKHQtLSl7CiAgICAgICAgbGwgbixoOwogICAgICAgIGNpbj4+bj4+aDsKICAgICAgICBsbCBhcnJbbl07CiAgICAgICAgbGwgc3VtPTA7CiAgICAgICAgbGwgYWxwaGE9MDsKICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKXsKICAgICAgICAgICAgY2luPj5hcnJbaV07CiAgICAgICAgICAgIHN1bSs9YXJyW2ldOwogICAgICAgICAgICBhbHBoYT1tYXgoYWxwaGEsYXJyW2ldKTsKICAgICAgICB9CiAgICAgICAgbGwgYW5zPXN1bSsxMDA7CiAgICAgICAgbGwgbD0xOwogICAgICAgIGxsIHI9YWxwaGE7CiAgICAgICAgd2hpbGUobDw9cil7CiAgICAgICAgICAgIGxsIG1pZD0obCtyKS8ybGw7CiAgICAgICAgICAgIGlmKGlzcG9zc2libGUoYXJyLG1pZCxuLGgpKXsKICAgICAgICAgICAgICAgIGFucz1taW4obWlkLGFucyk7CiAgICAgICAgICAgICAgICByPW1pZC0xOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgbD1taWQrMTsKICAgICAgICB9CiAgICAgICAgY291dDw8YW5zPDxlbmRsOwogICAgfQogICAgcmV0dXJuIDA7ICAgIAp9ICAgCgo=
compilation info
Traceback (most recent call last):
File "/usr/lib/python3.5/py_compile.py", line 125, in compile
_optimize=optimize)
File "<frozen importlib._bootstrap_external>", line 735, in source_to_code
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "./prog.py", line 2
using namespace std;
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.5/py_compile.py", line 129, in compile
raise py_exc
py_compile.PyCompileError: File "./prog.py", line 2
using namespace std;
^
SyntaxError: invalid syntax
stdout