import sys



N, K = [int(s) for s in input().split()]

ws = [int(input()) for _ in range(N)]

lo, hi = max(ws), 100000 * 10000



while lo != hi:

    p = P = (lo + hi) / 2

    k = 1

    for w in ws:

        if w > p:

            p = P

            k += 1

        p -= w

    if k <= K:

        hi = P

    else:

        lo = P + 1



print(lo)
N, K = [int(s) for s in input().split()]

ws = [int(input()) for _ in range(N)]

lo, hi = max(ws) - 1, sum(ws)



while hi - lo > 1:

    p = P = (lo + hi) / 2

    k = 1

    for w in ws:

        if w > p:

            p = P

            k += 1

        p -= w

    if k <= K:

        hi = P

    else:

        lo = P



print(hi)
import sys

N, K = [int(s) for s in input().split()]
ws = [int(input()) for _ in range(N)]
lo, hi = max(ws), 100000 * 10000
while lo != hi:
    p = P = (lo + hi) / 2
    k = 1
    for w in ws:
        if w > p:
            p = P
            k += 1
        p -= w
    if k <= K:
        hi = P
    else:
        lo = P + 1
print(lo)

N, K = [int(s) for s in input().split()]
ws = [int(input()) for _ in range(N)]
lo, hi = max(ws) - 1, sum(ws)
while hi - lo > 1:
    p = P = (lo + hi) / 2
    k = 1
    for w in ws:
        if w > p:
            p = P
            k += 1
        p -= w
    if k <= K:
        hi = P
    else:
        lo = P
print(hi)

-import sys - -lo, hi = max(ws), 100000 * 10000 -while lo != hi: +lo, hi = max(ws) - 1, sum(ws) +while hi - lo > 1: -        lo = P + 1 -print(lo) +        lo = P +print(hi)