import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int and(int[] a,int i,int j) { int and=a[i]; while(i+1=max) max=a[i]; i++; } return max;} static int min(int[] a,int i,int j) { int max=a[i]; while(i=k)) { len = j-i+1; left=i; right=j; } } } int[] B= new int[n]; for(int i=0;i=left-1&&i<=right-1) B[i]=len; else B[i]=-1; } return B; // Return a list of length n consisting of the answers } 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(); } }