LearnPy Hub
← Arena
IntermediateRating 1400

Fewest Coins

Print the minimum number of coins to make the amount (unlimited coins of each value), or -1.

Input

n amount, then n coin values.

Output

A number.

Sample 1

Input
3 11
1 2 5
Output
3

Sample 2

Input
1 3
2
Output
-1
solution.py
Output appears here
Fewest Coins · Python Arena problem · LearnPy Hub