#include <bits/stdc++.h>
int N, K, a[1000002], q[1000002], next[1000002];
int RMQ[20][1000001], *dep = RMQ[0], LOG[1000001];
struct heap {
  std::priority_queue<int> add, rmv;
  void push(int x) { add.push(x); }
  void del(int x) { rmv.push(x); }
  int top() {
    while (!rmv.empty() && add.top() == rmv.top()) {
      add.pop();
      rmv.pop();
    }
    return add.top();
  }
} answer;
int max_dep(int l, int r) {
  int Log = LOG[r - l + 1];
  return std::max(RMQ[Log][l], RMQ[Log][r - (1 << Log) + 1]);
}
int main() {
  scanf("%d%d", &N, &K);
  for (int i = 1; i <= N; i++) scanf("%d", a + i);
  for (int i = N, D = 0; i; i--) {
    while (D && a[q[D]] <= a[i]) D--;
    next[i] = D ? q[D] : N + 1;
    dep[i] = dep[next[i]] + 1;
    q[++D] = i;
  }
  for (int i = 1; 1 << i <= N; i++)
    for (int j = 1; j <= N - (1 << i) + 1; j++)
      RMQ[i][j] = std::max(RMQ[i - 1][j], RMQ[i - 1][j + (1 << i - 1)]);
  for (int i = 2; i <= N; i++) LOG[i] = LOG[i >> 1] + 1;
  for (int i = 1, H = 1, T = 0, l = 1, r = 0; i <= N - K + 1; i++) {
    while (r < i + K - 1) {
      while (H <= T && a[q[T]] <= a[r + 1]) {
        answer.del(max_dep(H == T ? l : q[T - 1] + 1, q[T]) - dep[next[q[T]]]);
        T--;
      }
      q[++T] = ++r;
      answer.push(max_dep(H == T ? l : q[T - 1] + 1, q[T]) - dep[next[q[T]]]);
    }
    while (l < i) {
      int before = max_dep(l, q[H]);
      l++;
      if (q[H] < l) {
        answer.del(before - dep[next[q[H]]]);
        H++;
      } else {
        int after = max_dep(l, q[H]);
        if (before != after) {
          answer.del(before - dep[next[q[H]]]);
          answer.push(after - dep[next[q[H]]]);
        }
      }
    }
    printf("%d\n", answer.top());
  }
  return 0;
}
