n,k=map(int,raw_input().split())
w=[input() for _ in range(n)]
l=max(w)
r=sum(w)
while l<r:
    m=(l+r)/2
    s=c=0
    for i in w:
        s+=i
        if s>m:s=i;c+=1
    if c<k:r=m
    else:l=m+1
print l n,k=map(int,raw_input().split()) n map(int,raw_input().split()) map int raw_input().split() ().split () raw_input split k input() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) input() input w=[input() for _ in range(n)] w [input() for _ in range(n)] l=max(w) l max(w) max w r=sum(w) r sum(w) sum w while l<r:
    m=(l+r)/2
    s=c=0
    for i in w:
        s+=i
        if s>m:s=i;c+=1
    if c<k:r=m
    else:l=m+1 l<r l r m=(l+r)/2 m (l+r)/2 l+r l r 2 s=c=0 s 0 =c=0 c 0 for i in w:
        s+=i
        if s>m:s=i;c+=1
     i w s+=i s i if s>m:s=i;c+=1
     s>m s m if c<k:r=m
    else:l=m+1 c<k c k print k=map(int,raw_input().split()) map(int,raw_input().split()) k l=max(w) max(w) l m=(l+r)/2 (l+r)/2 m s+=i i s r=sum(w) sum(w) r n,k=map(int,raw_input().split()) map(int,raw_input().split()) n c=0 0 c w=[input() for _ in range(n)] [input() for _ in range(n)] w s=c=0 0 s
n,k=map(int,raw_input().split())
w=[input() for _ in range(n)]
l=max(w)
r=sum(w)
while l<r:
    m=(l+r)/2
    s=c=0
    for i in w:
        s+=i
        if s>m:s=i;c+=1
    if c<k:r=m
    else:l=m+1
print l