cho.sh
Notes
Loading...

Minimum Coin Count

Time limit

1s

Memory limit

128 MB

Problem

You are given n types of coins. Each coin type may be used any number of times.

Using these coins, make a total value of exactly k. Find the minimum number of coins needed.

Input

The first line contains n and k. (1 <= n <= 100, 1 <= k <= 10,000)

Each of the next n lines contains one coin value. Every coin value is a positive integer no greater than 100,000. The same value may appear more than once.

Output

Print the minimum number of coins needed to make total value k. If it is impossible, print -1.