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 int b[] = new int[n]; Arrays.fill(b,-1); int maxInd = -1, minInd = -1; for(int i=0;i= k){ minInd = i+1;maxInd=i+1; } for(int j=i+1;j max) max = a[j]; cost = (or - and) - (max - min); if(cost >= k) { if(j-i> maxInd-minInd) { maxInd = j; minInd = i; //System.out.println(maxInd+" "+minInd); } } } } for(int i=minInd;i<=maxInd;i++) b[i] = maxInd-minInd+1; return b; } 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(); } }