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