N, K = map(int, input().split())
W = [int(input()) for w in range(N)]

def check(p):
    i = 0
    for _ in range(K):
        s = 0
        while s + W[i] <= p:
            s += W[i]
            i += 1
            if i == N:
                return N
    return i

left = 0
right = 100000 * 10000
mid = 0
while 1 < right - left:
    mid = (left + right) / 2
    v = check(mid)
    if v >= N:
        right = mid
    else:
        left = mid

print(int(right)) N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K int(input()) for w in range(N) for w in range(N) w range(N) range N for w in range(N) int(input()) int input() input W = [int(input()) for w in range(N)] W [int(input()) for w in range(N)] def check(p):
    i = 0
    for _ in range(K):
        s = 0
        while s + W[i] <= p:
            s += W[i]
            i += 1
            if i == N:
                return N
    return i check i = 0 i 0 for _ in range(K):
        s = 0
        while s + W[i] <= p:
            s += W[i]
            i += 1
            if i == N:
                return N
     _ range(K) range K s = 0 s 0 while s + W[i] <= p:
            s += W[i]
            i += 1
            if i == N:
                return N
     s + W[i] <= p s + W[i] s W[i] W i p s += W[i] s W[i] W i i += 1 i 1 if i == N:
                return N
     i == N i N return N N return i i p p left = 0 left 0 right = 100000 * 10000 right 100000 * 10000 100000 10000 mid = 0 mid 0 while 1 < right - left:
    mid = (left + right) / 2
    v = check(mid)
    if v >= N:
        right = mid
    else:
        left = mid 1 < right - left 1 right - left right left mid = (left + right) / 2 mid (left + right) / 2 left + right left right 2 v = check(mid) v check(mid) check mid if v >= N:
        right = mid
    else:
        left = mid v >= N v N right = mid right mid left = mid left mid print(int(right)) print int(right) int right left = 0 0 left right = mid mid right left = mid mid left W = [int(input()) for w in range(N)] [int(input()) for w in range(N)] W N, K = map(int, input().split()) map(int, input().split()) N mid = (left + right) / 2 (left + right) / 2 mid def check(p):
    i = 0
    for _ in range(K):
        s = 0
        while s + W[i] <= p:
            s += W[i]
            i += 1
            if i == N:
                return N
    return i def check(p):
    i = 0
    for _ in range(K):
        s = 0
        while s + W[i] <= p:
            s += W[i]
            i += 1
            if i == N:
                return N
    return i check K = map(int, input().split()) map(int, input().split()) K v = check(mid) check(mid) v mid = 0 0 mid right = 100000 * 10000 100000 * 10000 right
N, K = map(int, input().split())
W = [int(input()) for w in range(N)]

def check(p):
    i = 0
    for _ in range(K):
        s = 0
        while s + W[i] <= p:
            s += W[i]
            i += 1
            if i == N:
                return N
    return i

left = 0
right = 100000 * 10000
mid = 0
while 1 < right - left:
    mid = (left + right) / 2
    v = check(mid)
    if v >= N:
        right = mid
    else:
        left = mid

print(int(right))
