#include <bits/stdc++.h>
using namespace std;
#define sp " "
#define el '\n'
#define ll long long
const int N = 200000;
const int MAX_TIME = 2e9;
int n, hours, a[N];
bool ok(int k){
    int current_hours = 0;
    for(int i = 1; i <= n; i++){
        current_hours += ceil ((double)a[i] / k);
    }
    return current_hours <= hours;
}
void solve()
{
    cin >> n >> hours;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    int l = 1, r = 1e9, ans = 0;
    while(l <= r){
        int mid = l + (r - l) / 2;
        if(ok(mid)){
            ans = mid;
            r = mid - 1;
        }        
        else l = mid + 1;
    }
    cout << ans << endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t; cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}
