import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int[] costlyIntervals(int n, int k, int[] A) { // Return a list of length n consisting of the answers ArrayList al = new ArrayList(); for(int i=0; imax) max=subarray[j]; if(subarray[j]0){ orC |=subarray[j]; andC &=subarray[j]; } } //System.out.println(java.util.Arrays.toString(Arrays.copyOfRange(A, i, m))); int cost = orC-andC-(max-min); if(cost>=k){ //System.out.println("here"); al.add(Arrays.copyOfRange(A, i, m)); } //System.out.println(orC-andC-(max-min)); } } int[] rtn = new int[A.length]; for(int p=0; psize) size=arr.length; } } } rtn[p]=size; } return rtn; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int[] A = new int[n]; for(int A_i = 0; A_i < n; A_i++){ A[A_i] = in.nextInt(); } int[] result = costlyIntervals(n, k, A); for (int i = 0; i < result.length; i++) { System.out.print(result[i] + (i != result.length - 1 ? "\n" : "")); } System.out.println(""); in.close(); } }