rt
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ewen using
#define ak namespace
#define ioi std
#define ewen_ak_ioi return 0;
ewen ak ioi;
ll in(){
char c = getchar();
int x = 0, f = 1;
for (; c < '0' || c > '9'; c = getchar())
if (c == '-') f = -1;
for (; c >= '0' && c <= '9'; c = getchar())
x = (x << 1) + (x << 3) + (c ^ 48);
return x * f;
}
void put(int x){
if (x < 0) x = -x, putchar('-');
if (x > 9) put(x / 10);
putchar(x % 10 + '0');
}
int a[114514],dp[1919810];
int main()
{
int t;scanf("%d",&t);
while(t--)
{
int n=in(),h=in();
for(int i=1;i<=n;i++)a[i]=in();
for(int i=1;i<=n;i++)
{
for(int j=h;j>=0;j--)
{
if(j>=a[i])
{
dp[j]=max(dp[j-a[i]]+a[i],dp[j]);
}
}
}
if(dp[h]<h)puts("-1");
else printf("%d\n",dp[h]);
memset(a,0,114514*4);
memset(dp,0,1919810*4);
}
ewen_ak_ioi
}