import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { //your code here Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int arr[]=new int[n]; for(int i=0;ilow){ low=arr[i]; } sum+=arr[i]; } if(b==n){ System.out.print(low); return; } int high=sum; int res=0; while(low<=high){ int mid=low+(high-low)/2; if(isPossible(arr,n,b,mid)==true){ res=mid; high=mid-1; } else{ low=mid+1; } } System.out.print(res); } public static boolean isPossible(int arr[] , int n, int b, int mid){ int day=1; int sum=0; for(int i=0;imid){ day++; sum=arr[i]; } } return day<=b; } }