For this Question: Given an integer K and an array height[] of size N, where height[i] denotes the height of the ith tree in a forest. The task is to make a cut of height X from the ground such that at max K units wood is collected. Find the minimum value of X
<b>If you make a cut of height X from the ground then every tree with a height greater than X will be reduced to X and the remaining part of the wood can be collected</b>The first line contains two integers N and K.
The next line contains N integers denoting the elements of the array height[]

<b>Constraints</b>
1 &le; N &le; 10<sup>5</sup>
1 &le; arr[i] &le; 10<sup>5</sup>
1 &le; K &le; 10<sup>7</sup>Print a single integer with the value of X.Sample Input:
4 2
1 2 1 2

Sample Output:
1

<b>Explanation:</b>
Make a cut at height 1, the updated array will be {1, 1, 1, 1} and
the collected wood will be {0, 1, 0, 1} i. e. 0 + 1 + 0 + 1 = 2., I have written this Solution Code: import java.io.*; // for handling input/output
import java.util.*; // contains Collections framework

// don't change the name of this class
// you can add inner classes if needed
class Main {
	public static void main (String[] args) {
                      // Your code here
	   Scanner sc = new Scanner(System.in);
	   int n = sc.nextInt();
	   int k = sc.nextInt();

	   int arr[] = new int[n];

	   for(int i = 0; i < n; i++)
	   	arr[i] = sc.nextInt();

	   System.out.println(minValue(arr, n, k));
	}

	static int minValue(int arr[], int N, int k)
	{
		int l = 0, h = N;
		while(l+1 < h){
			int m = (l + h) >> 1;
			if(f(arr, m, N) <= k)
				h = m;
			else
				l = m;
		}

		 return h;
	}

	static int f(int a[], int x, int n)
	{
		int sum = 0;
		for(int i = 0; i < n; i++)
			sum += Math.max(a[i]-x, 0);
		return sum;
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?