def elevator(dumps, weight):
result = 0
dumps.sort()
while (dumps):
dump = dumps.pop()
div = weight // dump
mod = weight % dump
if dumps == []:
if mod is not 0:
return -1
else:
result += div
else:
if div:
result += div
weight -= div * dump
return result
if __name__ == '__main__':
print(elevator([3,9],24))
# 4
print(elevator([2,3],10))
# -1