I'm getting sample output but on submitting its says wrong answer

problem code:-MINFD

for _ in range(int(input())):

a,n = map(int, input().split())

s = list(map(int, input().split()))

count = 0

sa = 0

if sum(s)<n:

    print("-1")

else:

    for i in s:

        if sa<n:

            count+=1

            sa+=i

       

    print(count)

I can’t understand what wrong I’m doing here

Hi, we were required to get a minimum number of fixed deposits. So it’s always optimal to choose the maximum ones first. So we first will sort the list and then choose the elements.