import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int orFun(int l,int r,int[] A) { int or=A[l]; for(int i=l+1;i<=r;i++) { or=or|A[i]; } return or; } static int andFun(int l,int r,int[] A) { int an=A[l]; for(int i=l+1;i<=r;i++) { an=an&A[i]; } return an; } static int maxFun(int l,int r,int[] A) { int max=A[l]; for(int i=l+1;i<=r;i++) { if(maxA[i]) { min=A[i]; } } return min; } static int[] costlyIntervals(int n, int k, int[] A) { // Return a list of length n consisting of the answers int len=A.length; int temp; int[] cost=new int[len]; for(int i=0;i=k) { for(int i=l;i<=r;i++) { if(cost[i]<(r-l+1)) { cost[i]=r-l+1;} } } } } return cost; } 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(); } }