## LCC/Moose '20 Contest 2 S3 - Alan's Got Cake 😳

View as PDF

Points: 12 (partial)
Time limit: 5.0s
Memory limit: 256M

Author:
Problem types

Alan has a circular cake which he wants to share with his friends. Unfortunately, this cake is notoriously difficult to cut, and thus the company who supplied the cake also included dents in various locations that are easier to cut through. The dents separate the cake into sections each with an integer size . Since Alan is a good friend, after the cake is cut he will take the smallest remaining piece. However, Alan loves cake, so he wants to cut at of the dents such that the smallest remaining piece is as large as possible. Can you help him?

#### Input Specification

The first line contains two integers .

The next line contains integers .

#### Output Specification

The only line of output is to contain one integer, the maximum length of the smallest piece.

No further constraints.

#### Sample Input

5 3
5 2 6 9 3

#### Sample Output

8

#### Sample Explanation

Alan cuts between and , between and , and between and , leaving the cake with pieces of size , , and .