Batteries
On the day of the competition, the laboratory uses computers. Unfortunately, the electricity is turned off, and the computers can only work on batteries. The technical staff of the competition has batteries. The -th battery allows any computer to work for minutes.
Initially, they can fit no more than one battery per computer. After that, at any minute, you can remove the current battery from any computer and insert another one. The inserted battery can be either new or taken from another computer. You can assume that the process of removing and installing the battery takes no time. Also, note that batteries are not rechargeable.
To determine the duration of the competition, the organizers want to know the maximum number of minutes during which all computers can be used simultaneously. It is quite difficult for the technical staff to determine this. Help them with this.
Input
The first line contains two integers and — the number of computers and batteries, respectively. The next line contains integers — the capacity of the batteries.
Output
Output an integer — the maximum number of minutes during which all computers can work simultaneously.
Examples
In this example, there are computers and batteries. Each battery has a capacity of minutes. Initially, we place the first and second batteries in the first and second computers, respectively. After minutes, remove the battery from the first computer and insert the third battery (still fully charged) into the first computer. At the end of the rd minute, the battery in the second computer will discharge, let's remove it and replace it with the first battery that we removed from the first computer, which still has minute left. At the end of the th minute, this battery will also discharge. Although the first computer's battery currently has minute left, the other batteries are already discharged, and we can no longer sustain the operation of both computers.
Scoring
This problem consists of subtasks. Points for a subtask are awarded only if all the tests associated with that subtask are passed successfully.
( points): ;
( points): ;
( points): ;
( points): ;
( points): ;