//please give me some test cases where it fails…
//AND if there is any wrong approach please summarise it.
#include<bits/stdc++.h>
using namespace std;
bool degakinahi(int coins[],int n,int money)
{
while(money>0)
{
int idx=upper_bound(coins,coins+n,money)-coins-1;
if(idx<0)
break;
money=money-coins[idx];
coins[idx]=INT_MAX;
sort(coins,coins+n);
}
return money==0;
}
int main()
{
int t,n,m;
cin>>t;
while(t–)
{
cin>>n>>m;
int coins[n];
for(int i=0;i<n;i++)
cin>>coins[i];
sort(coins,coins+n);
if(degakinahi(coins,n,m))
cout<<“Yes”<<’\n’;
else
cout<<“No”<<’\n’;
}
}