Skip to content
UPEEC

Minimum Soldering Speed

Hard#searching#binary-search#binary-search-on-answer· solved by 0 · time limit 2.0 s

There are nn boards; board ii has aia_i joints to solder. You solder at a fixed speed of kk joints per hour, working on one board per hour (if a board has fewer than kk joints left, you finish it and rest for the rest of that hour). What is the smallest integer kk that finishes everything within hh hours?

Try binary search on the answer.

Input

nn, then a1…ana_1 \dots a_n, then hh.

Output

The minimum speed kk.

Constraints

1≤n≤1041 \le n \le 10^4, n≤h≤109n \le h \le 10^9, 1≤ai≤1091 \le a_i \le 10^9

Sample 1

Input

4
3 6 7 11
8

Output

4

Sample 2

Input

5
30 11 23 4 20
5

Output

30

Sign in or join free to run and submit your solution.