Under construction

Still being built. Things may change

Seating Arrangement

Time limit2sMemory limit1024 MB

Summary
Given the head counts of K schools, find the largest room size when all students are split as evenly as possible across M rooms.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Statement

Olympiad preparation has many tasks for the jury and organizing committee, such as writing statements, preparing tests, writing solutions, and setting up computers. It is easy to forget to seat the participants in the rooms correctly. This time, the committee wants to use the seats efficiently and plans a compact seating of the schoolchildren into MM available rooms. A seating is called compact if, for any two different rooms, the numbers of children in them differ by at most one. A member of the jury with extrasensory abilities predicted that students from KK schools will reach the on-site round. He also predicted that exactly nin_i students will come from the ii-th school (1≤i≤K1 \le i \le K). Many committee members are skeptical of such predictions, but they have a habit of coming true. Assuming the predictions are correct, find the maximum possible number of participants who can be in one room under a compact seating.

Input

The first line contains two integers MM and KK, the number of rooms and the number of schools (1≤M≤1091 \le M \le 10^9, 1≤K≤1000001 \le K \le 100000). The second line contains KK integers n1,n2,…,nKn_1, n_2, \ldots, n_K separated by spaces (1≤ni≤1091 \le n_i \le 10^9).

Output

Print one integer, the maximum number of people in one room under a compact seating.

Hint

In the first test, there is only one compact seating: each of the two rooms gets 7 people.

Examples2

  1. Example 1

    Input
    2 2
    5 9
    
    Expected output
    7
    
  2. Example 2

    Input
    1 2
    20 10
    
    Expected output
    30