Problem:
Score : 500 points

Problem Statement

We have N logs of lengths A_1,A_2,\cdots A_N.

We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.

Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.

Constraints

1 \leq N \leq 2 \times 10^5

0 \leq K \leq 10^9

1 \leq A_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 \cdots A_N

Output

Print an integer representing the answer.

Sample Input 1

2 3
7 9

Sample Output 1

4

First, we will cut the log of length 7 at a point whose distance from an end of the log is 3.5, resulting in two logs of length 3.5 each.

Next, we will cut the log of length 9 at a point whose distance from an end of the log is 3, resulting in two logs of length 3 and 6.

Lastly, we will cut the log of length 6 at a point whose distance from an end of the log is 3.3, resulting in two logs of length 3.3 and 2.7.

In this case, the longest length of a log will be 3.5, which is the shortest possible result. After rounding up to an integer, the output should be 4.

Sample Input 2

3 0
3 4 5

Sample Output 2

5

Sample Input 3

10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202

Sample Output 3

292638192

Solution in C# (.NET Core 3.1.201) (judge verdict: Wrong Answer)

using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramE a = new ProgramE();
            a.main();//実行する

        }

    }
    //ABC170
    class ProgramA
    {
        public void main()
        {
            //入力
            int x = int.Parse(Console.ReadLine());


            if (x >= 30)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

        }
    }

    class ProgramB
    {
        public void main()
        {
            //入力
            
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]);
            long d = long.Parse(s[1]);

            long count = 0;
            for(int i = 0; i < n;i++)
            {
                string[] t = Console.ReadLine().Split(' ');
                long x = long.Parse(t[0]);
                long y = long.Parse(t[1]);
                if (x * x + y * y <= d * d)
                    count++;
            }

            Console.WriteLine(count);

        }
    }

    class ProgramC
    {
        public void main()
        {

            //入力
            int k = int.Parse(Console.ReadLine());

            if(k % 2 == 0)
            {
                Console.WriteLine("-1");
                return;
            }

            if (7 % k == 0)
            {
                Console.WriteLine("1");
                return;
            }


            int flag = 0;
            long num = 7;
            long count = 1;

            while(flag == 0)
            {
                count++;
                num *= 10;
                num += 7;
                num %= k;
                if (num == 0)
                    flag = 1;
                if (count >= 10000000)
                {
                    Console.WriteLine("-1");
                    return;
                }
                
            }

            Console.WriteLine(count);




        }
    }

    class ProgramD
    {
        public void main()
        {

            //入力
            long n = long.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            int wc = 0;
            int rc = 0;
            for (int i = 0; i < n; i++)
            {
                if (s[i] == 'R')
                    rc++;
                else
                    wc++;
            }

            if (wc == 0)
            {
                Console.WriteLine("0");
                return;
            }

            int rw = 0;
            int ww = 0;

            for (int i = 0; i < rc; i++)
            {
                if (s[i] == 'W')
                    rw++;
            }

            for (int i = rc; i < n; i++)
            {
                if (s[i] == 'R')
                    ww++;
            }

            
            Console.WriteLine(Math.Min(rw,ww) + Math.Abs(rw - ww));
            

        }

    }

    class ProgramE
    {

        public void main()
        {
            //入力
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]);
            long k = long.Parse(s[1]);

            long[] a = new long[n];

            string[] t = Console.ReadLine().Split(' ');

            for(int i = 0;i < n;i++)
                a[i] = long.Parse(t[i]);

            long min = 1;
            long max = a.Max();

            while(min + 1 != max)
            {
                long temp = (min + max) / 2;
                long cut = 0;
                for (int i = 0; i < n; i++)
                {
                    if (a[i] < temp)
                        continue;

                    if(a[i] % temp == 0)
                        cut += a[i] / temp - 1;
                    else
                        cut += a[i] / temp;
                }

                if (cut <= k)
                    max = temp;
                else
                    min = temp;

            }

            Console.WriteLine(max);

        }


    }

}