Function to check if the value of mid gives at least ( N / ( M + 1 ) ) candies or not
static boolean check ( int K , int n , int m , ArrayList < Integer > arr , int good_share ) { int candies = n , taken = 0 ; while ( candies > 0 ) {