#include<bits/stdc++.h>
#define COGS
using namespace std;
const int maxn=100010;
long long n,m,now,k,a[maxn];
long long sum;
inline void in(){
#ifdef COGS
freopen("autoac.in","r",stdin);
freopen("autoac.out","w",stdout);
#endif
scanf("%lld%lld",&m,&k);
for (int i=1;i<=m;i++){
scanf("%lld",&a[i]);
if (a[i]) sum+=a[i];
}
}
inline long long check(long long x){
int ans=0;long long temp=0;
for (int i=1;i<=m;i++){
temp+=a[i];
if (temp<0) temp=0;
if (temp>x) ans++,temp=0;
}
return ans;
}
inline void deal(){
long long l=1,r=sum;
long long mid;
while (l<=r){
mid=(l+r)>>1;
if (check(mid)<=k) r=mid-1;
else l=mid+1;
}
if (check(l)!=k){
printf("-1");
return;
}
if (m==k) l--;
printf("%lld ",l+1);
l=1,r=sum;
while (l<=r){
mid=(l+r)>>1;
if (check(mid)>=k) l=mid+1;
else r=mid-1;
}
printf("%lld",r+1);
}
int Main(){
in();
deal();
return 0;
}
int main(){;}
int xlm=Main();