Problem list
Log in
#coci00235 · COCI 2012/2013 Contest 1

Ljubomora

Silver I 1.0 s 32 MB

A marble factory has donated a large box of marbles to a kindergarten. Each marble has one out of M different colours. The governess needs to divide all the marbles between the N children in her group. It is acceptable if some children don't get any marbles. However, no child wants marbles of different colours – in other words, all marbles that a child gets need to be the same colour. The governess also knows that children will be jealous if a child gets too many marbles. As an approximation, we will define the envy level in the group as the largest number of marbles given to one child. Help the governess divide the marbles in order to minimize the envy level. For example, if the box contains 4 red marbles (RRRR) and 7 blue marbles (BBBBBBB) which we have to divide between 5 children, we can achieve an envy level of 3 by dividing the marbles in the following way: RR, RR, BB, BB, BBB. This is the lowest achievable envy level.

Input

The first line of input contains two positive integers, N ($1 \le N \le 10^{9}$), the number of children, and M ($1 \le M \le 300,000$, $M \le N$), the number of different colours. Each of the following M lines contains a positive integer from the interval [1, $10^{9}$], with the integer in line K denoting the number of marbles with colour K.

Output

The first and only line of output should contain the minimum possible envy level.

Example 1

Input
5 2
7
4
Output
3

Example 2

Input
7 5
7
1
7
4
4
Output
4
Source
COCI 2012/2013 Contest 1
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code