CODE:

import heapq
# Enter your code here. Read input from STDIN. Print output to STDOUT
n,k = map(int,raw_input().split())
sweetness = map(int,raw_input().split())
heapq.heapify(sweetness)
c= 0
while len(sweetness)>1:
    if sweetness[0]>=k:
        break
    heapq.heappush(sweetness,heapq.heappop(sweetness)+2*heapq.heappop(sweetness))
    c+=1
print (c if sweetness[0]>=k else -1)

results matching ""

    No results matching ""