The Final Weapon, the Bow

Time limit1sMemory limit512 MB

Summary
Cut a circular rubber band at K of M marked notches into K arcs; maximize the shortest arc among the K pieces.
Level

Medium7 of 10

Topics
Binary search, Greedy, Array, Implementation
Solved
No attempts yet

Problem

Jihun decided to build a bow himself. A bow has a wooden limb and a string made of rubber, and it is finished by hooking the string onto the limb. His father is a carpenter and makes the limb in whatever length and shape Jihun asks for, so Jihun only has to prepare the rubber for the string.

The rubber band he bought at the stationery store is a loop of circumference NN. The band has MM notches cut into it, and the rubber is so tough that it can be cut only at a notch. A notch position XX is measured from the 12 o'clock direction, which is 00, and increases by 11 clockwise, so XX is an integer between 00 and N−1N-1.

A good bow needs a string of KK layers. Jihun therefore cuts the loop into KK straight rubber strands, stacks those KK strands, and hooks them onto the limb. The length of the bow is the length of the shortest strand among them.

Find the longest bow Jihun can make.

The picture below shows the band for N=20N = 20, M=3M = 3, X={2,4,6}X = \{2, 4, 6\}.

A loop of rubber with notch positions

Input

The first line contains the circumference of the band NN, the number of notches MM where a cut is possible, and the number of layers KK the bow needs. All three are integers with 1≤N≤1000001 \le N \le 100000, 1≤M≤min⁡(N,1000)1 \le M \le \min(N, 1000), and 1≤K≤M1 \le K \le M.

Each of the next MM lines contains one notch position XX, an integer with 0≤X≤N−10 \le X \le N-1. The notch positions are distinct and are given in ascending order.

Output

Print the length of the longest bow that can be made. If no bow can be made, print -1.

Examples2

  1. Example 1

    Input
    20 3 3
    2
    4
    6
    
    Expected output
    2
    
  2. Example 2

    Input
    20 3 1
    2
    4
    6
    
    Expected output
    20