#include<bits/stdc++.h>
#define int long long
using namespace std;
ifstream fin("NPH.in");
ofstream fout("NPH.out");
auto mread = [](){
int x;
fin >> x;
return x;
};
int C(int n, int m){
int ans = 1;
for(int i = n; i >= n - m + 1; i --)
ans *= i;
for(int i = 1; i <= m; i ++)
ans /= i;
return ans;
}
signed main(){
int t = mread();
while(t --){
int n = mread(), k = mread();
int a[n + 5];
for(int i = 1; i <= n; i ++)
a[i] = mread();
if(n == 1){
fout << a[1] * k << "\n";
continue;
}
{
int e = 1;
for(int i = 1; i <= n; i ++){
if(a[i] != 1)
e = 0;
}
if(e){
int sum = 0;
for(int i = 1; 1; i ++){
sum += C(i + n - 1, n - 1);
if(sum >= k){
fout << i << "\n";
break;
}
}
continue;
}
}
if(k <= 100000){
vector<int> f;
f.push_back(1);
int sum = 0;
for(int i = 1; 1; i ++){
int ans = 0;
for(int j = 1; j <= n; j ++){
if(i - a[j] >= 0)
ans += f[i - a[j]];
}
sum += ans;
f.push_back(ans);
// printf("*** %lld\n", ans);
if(sum >= k){
fout << i << "\n";
break;
}
}
continue;
}
}
}