fork download
  1. for _ in range(int(input())):
  2. n,m=map(int,input().split())
  3. lst=[int(x) for x in input().split()]
  4. lst.sort(reverse=1)
  5. k=0
  6. for i in range(n):
  7.  
  8. if m-lst[i] in lst or m-lst[i]==0:
  9. m-=lst[i]
  10. k+=1
  11. print(k if m==0 else -1)# your code goes here
Runtime error #stdin #stdout #stderr 0.02s 27664KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
EOFError: EOF when reading a line