#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int N = 1e6 + 10;
const int inf = 1 << 30;
const long long md = 998244353;
int n, k, a[N], lg[N], mx[N][20], head[N], pos, dfn[N], rnk[N], dfscnt,
    anc[N][20], siz[N];
struct edge {
  int nxt, to;
} e[N << 1];
void add(int u, int v) {
  e[++pos] = (edge){head[u], v};
  head[u] = pos;
}
int Query(int l, int r) {
  int k = lg[r - l + 1];
  return max(mx[l][k], mx[r - (1 << k) + 1][k]);
}
int seg[N << 2], tag[N << 2];
void pushup(int rt) { seg[rt] = max(seg[rt << 1], seg[rt << 1 | 1]); }
void pushdown(int rt) {
  if (tag[rt]) {
    seg[rt << 1] += tag[rt];
    seg[rt << 1 | 1] += tag[rt];
    tag[rt << 1] += tag[rt];
    tag[rt << 1 | 1] += tag[rt];
    tag[rt] = 0;
  }
}
void motify(int rt, int l, int r, int ql, int qr, int d) {
  if (ql <= l && r <= qr) {
    tag[rt] += d;
    seg[rt] += d;
    return;
  }
  int mid = l + r >> 1;
  pushdown(rt);
  if (mid >= ql) motify(rt << 1, l, mid, ql, qr, d);
  if (mid + 1 <= qr) motify(rt << 1 | 1, mid + 1, r, ql, qr, d);
  pushup(rt);
}
void dfs(int u, int fa) {
  int i;
  dfn[u] = ++dfscnt;
  rnk[dfscnt] = u;
  siz[u] = 1;
  for (i = head[u]; i; i = e[i].nxt) {
    if (e[i].to == fa) continue;
    dfs(e[i].to, u);
    siz[u] += siz[e[i].to];
    anc[e[i].to][0] = u;
  }
}
void ins(int u) { motify(1, 1, n, dfn[u], dfn[u] + siz[u] - 1, 1); }
void del(int u) { motify(1, 1, n, dfn[u], dfn[u], -inf); }
int main() {
  scanf("%d%d", &n, &k);
  int i, j;
  for (i = 1; i <= n; ++i) scanf("%d", &a[i]), mx[i][0] = a[i];
  for (j = 1; j <= 19; ++j)
    for (i = 1; i + (1 << j) - 1 <= n; ++i)
      mx[i][j] = max(mx[i][j - 1], mx[i + (1 << j - 1)][j - 1]);
  for (i = 2; i <= n; ++i) lg[i] = lg[i >> 1] + 1;
  for (i = 1; i <= n; ++i) {
    int l = i, r = n;
    if (Query(i, n) == a[i]) continue;
    while (l < r - 1) {
      int mid = l + r >> 1;
      if (Query(i, mid) > a[i])
        r = mid;
      else
        l = mid + 1;
    }
    if (Query(i, l) > a[i])
      add(i, l), add(l, i);
    else
      add(i, r), add(r, i);
  }
  for (i = n; i >= 1; --i)
    if (!dfn[i]) dfs(i, 0);
  for (j = 1; j <= 19; ++j)
    for (i = 1; i <= n; ++i) anc[i][j] = anc[anc[i][j - 1]][j - 1];
  for (i = 1; i <= k; ++i) ins(i);
  printf("%d ", seg[1]);
  for (i = 2; i + k - 1 <= n; ++i) {
    ins(i + k - 1);
    del(i - 1);
    printf("%d ", seg[1]);
  }
}
