#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define vii vector<pii>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rp(i,a,n) for(int i=a;i<=int(n);i++)
#define IT(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define all(x) (x).begin(), (x).end()
#define ll unsigned long long int
#define oo INT_MAX
#define fill(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define mod 1000000007
using namespace std;
int a[20],s,n,dp[12][2005][12];
int f(int i,int sum,int cnt,int mn)
{
if(i==n) {if(sum>=s)return cnt;else return 0;}
if(dp[i][sum][cnt]!=-1) return dp[i][sum][cnt];
int ans=0;
ans=max(ans,f(i+1,sum,cnt,mn));
if(sum+a[i]-mn<s) ans=max(ans,f(i+1,sum+a[i],cnt+1,min(mn,a[i])));
return dp[i][sum][cnt]=ans;
}
int main()
{
int t;
cin >> t ;
rep(kk,t)
{
cin >> n >> s;
rep(i,n) scanf("%d",a+i);
fill(dp,-1);
cout << f(0,0,0,1000) << endl ;
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgbXAgbWFrZV9wYWlyCiNkZWZpbmUgcGIgcHVzaF9iYWNrCiNkZWZpbmUgdmkgdmVjdG9yPGludD4KI2RlZmluZSBwaWkgcGFpcjxpbnQsaW50PgojZGVmaW5lIHZpaSB2ZWN0b3I8cGlpPgojZGVmaW5lIHJlcChpLG4pIGZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspCiNkZWZpbmUgcnAoaSxhLG4pIGZvcihpbnQgaT1hO2k8PWludChuKTtpKyspCiNkZWZpbmUgSVQoYyxpdHIpIGZvcihfX3R5cGVvZigoYykuYmVnaW4oKSkgaXRyPShjKS5iZWdpbigpO2l0ciE9KGMpLmVuZCgpO2l0cisrKQojZGVmaW5lIGFsbCh4KSAoeCkuYmVnaW4oKSwgKHgpLmVuZCgpCiNkZWZpbmUgbGwgdW5zaWduZWQ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