#BS0000025. Máy cưa gỗ (EKO)
Máy cưa gỗ (EKO)
EKO
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
There are trees with heights . A saw set at integer height cuts off the part above , producing units of wood. Find the maximum that still produces at least units.
Input
The first line contains . The second line contains the tree heights.
Output
Print the maximum valid saw height.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , , . The sum of all heights is greater than .
Examples
Input
4 7
20 15 10 17
Output
15
Explanation
At we obtain units. At we obtain only , so is optimal.