This page is still under construction.

Parts of this page are still being built. What you see may change.

Human Pipeline

Time limit1.5sMemory limit1024 MB

Summary
Split N people into two nonempty teams so the larger of the two team times ceil(K / (min speed times team size)) is minimized.
Level

Medium6 of 10

Topics
Greedy, Sorting, Binary search, Math
Solved
No attempts yet

Problem

Today is an important day. It is the day of SUAPC.

Despite how important the day is, unfortunately there is work to do. Today's task is to move KK boxes to suitable places.

Since KK boxes are far too many for one person to carry alone, NN SUAPC participants have gathered to carry the boxes. All NN of them want to finish the work as quickly as possible and join SUAPC.

The participants decided to split into two teams and work. The two teams do not need to carry the same number of boxes. Each team must contain at least one person. Person ii's work speed per minute is viv_i, and a team's work speed is

(the slowest work speed among the team’s members)×(the number of people on the team).(\text{the slowest work speed among the team's members}) \times (\text{the number of people on the team}).

When a team carrying KK boxes has work speed vv per minute, the team takes ⌈Kv⌉\left\lceil \frac{K}{v} \right\rceil minutes to finish the work.

So that everyone can happily join SUAPC, split the NN people into two teams appropriately so that all boxes are carried as fast as possible, and find the time when the two teams start carrying boxes at the same time and finish the earliest.

Input

The input is given as follows.

NN KK
v1v_1 v2v_2 ⋯\cdots vNv_N

  • NN is the number of people gathered. (2≤N≤200 0002 \le N \le 200\,000)
  • KK is the number of boxes to move. (1≤K≤10181 \le K \le 10^{18})
  • viv_i is the work speed of person ii per minute, meaning they can move viv_i boxes in one minute. (1≤vi≤1091 \le v_i \le 10^9)
  • All numbers in the input are integers.

Output

Print the work time in minutes for the case that moves all boxes as fast as possible.

Examples2

  1. Example 1

    Input
    5 100
    3 1 2 4 5
    
    Expected output
    10
    
  2. Example 2

    Input
    2 15600000
    500 1000
    
    Expected output
    10400