#include<iostream>
using namespace std;
typedef long long LL;
const int N=1e5+10,INF=1e15;
LL m,k;
LL a[N];
LL res=-1;
int check(int n)
{
LL sum=0;
int ans=0;
for(int i=1;i<=m;++i)
{
sum+=a[i];
if(sum<0)sum=0;
if(sum>=n)ans++,sum=0;
}
return ans;
}
int main()
{
ios::sync_with_stdio(0);cin.tie(0);
cin>>m>>k;
for(int i=1;i<=m;++i)
cin>>a[i];
LL l=1,r=INF;
while(l<r)//求最小值
{
LL mid=(l+r)/2;
int t=check(mid);
if(t>k)l=mid+1;
else if(t<k)r=mid;
else if(t==k)res=mid,r=mid;
}
if(res==-1){cout<<-1;return 0;}
cout<<res<<" ";
l=1,r=INF;
while(l<r)//最大值
{
LL mid=(l+r)/2;
int t=check(mid);
if(t>k)l=mid+1;
else if(t<k)r=mid;
else if(t==k)res=mid,l=mid+1;
}
cout<<res<<endl;
return 0;
}