#include <bits/stdc++.h>
using namespace std;
#define SC scanf
#define PF printf
#define ull unsigned long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define sort_a(a) sort(a.begin(),a.end());
#define sort_d(a) sort(a.rbegin(),a.rend());
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define rev(s) reverse(s.begin(),s.end())
#define P(ok) cout << (ok ? "YES\n": "NO\n")
#define __Heart__ ios_base :: sync_with_stdio(false); cin.tie(NULL);
#define ll long long
typedef pair< ll , ll> PII;
void solve()
{
ll n , s ; cin >> n >> s; ll a[n] ;
for(int i = 0 ; i < n ; i++) cin >> a[i];
ll Low = 1 , High = 1e9 ;
bool ok = 1 ;
while(Low < High){
ll X = (Low + High + 1) >> 1 ;
ll curSum = 0 ;
for(auto it : a) curSum += (it / X) ;
if(curSum == s){
cout << X << "\n" ;
ok = 0 ;
break ;
}
if(curSum > s) Low = X + 1 ;
else High = X - 1 ;
//cout << Low << " " << High << " " << X << " " << curSum << endl ;
}
if(ok)cout << -1 << "\n" ;
}
int main()
{
__Heart__
// READ("0in.txt") ;
// WRITE("0out.txt") ;
int t ; cin >> t ; while(t--) solve() ;
}