Under construction

Still being built. Things may change

Coins 0

Interview

Time limit1sMemory limit256 MB

Summary
Pay exactly K with the fewest coins from denominations where each divides the next.
Level

Easy3 of 10

Topics
Greedy
Solved
No attempts yet

Problem

You have unlimited coins of NN denominations. Denominations are sorted ascending, A1=1A_1 = 1, and each AiA_i is a multiple of Ai−1A_{i-1}. Find the minimum number of coins whose total value is exactly KK.

Input

Line 1: NN and KK (1≤N≤101 \leq N \leq 10, 1≤K≤1000000001 \leq K \leq 100000000). Next NN lines: coin values AiA_i in ascending order (1≤Ai≤10000001 \leq A_i \leq 1000000).

Output

Print the minimum coin count.

Examples2

  1. Example 1

    Input
    10 4200
    1
    5
    10
    50
    100
    500
    1000
    5000
    10000
    50000
    
    Expected output
    6
    
  2. Example 2

    Input
    10 4790
    1
    5
    10
    50
    100
    500
    1000
    5000
    10000
    50000
    
    Expected output
    12