https://www.codechef.com/problems/A1 :- this is the link to my question

my solution is this :-

t=int(input())

while(t):

```
n,m=map(int,input().split())
a=[]
for i in range(0,n):
a.append(int(input()))
a=sorted(a,reverse=True)
while(m>0):
flag=0
for i in a:
if(i<=m):
flag=1
m=m-i
a.remove(i)
break
if(flag==0):
break
if(m==0):
print('Yes')
else:
print('No')
t-=1
```

this logic is giving wrong answer but i do not understand for which case .