#include <bits/stdc++.h>
using namespace std;
int n, m, a[1200000], stk[1200000], dfn[1200000], head[1200000], tot, clk,
    fst[1200000], lst[1200000], seg[1200000 << 2], fa[1200000], mx[1200000],
    dep[1200000];
struct edge {
  int v, nxt;
} e[1200000];
multiset<int> se;
int gfa(int x) { return x == fa[x] ? x : fa[x] = gfa(fa[x]); }
void add(int x, int y) {
  e[++tot].v = y;
  e[tot].nxt = head[x];
  head[x] = tot;
}
void dfs(int u) {
  dfn[u] = ++clk;
  fst[u] = lst[u] = clk;
  for (int i = head[u], v; i; i = e[i].nxt) {
    dep[v = e[i].v] = dep[u] + 1;
    dfs(v);
    lst[u] = clk;
  }
}
void mdf(int x, int l, int r, int t, int k) {
  if (l == r) {
    seg[x] = k;
    return;
  }
  int mid = (l + r) >> 1;
  if (t <= mid)
    mdf((x << 1), l, mid, t, k);
  else
    mdf((x << 1 | 1), mid + 1, r, t, k);
  seg[x] = max(seg[(x << 1)], seg[(x << 1 | 1)]);
}
int qry(int x, int l, int r, int L, int R) {
  if (l >= L && r <= R) return seg[x];
  int mid = (l + r) >> 1, tmp = 0;
  if (L <= mid) tmp = max(tmp, qry((x << 1), l, mid, L, R));
  if (R > mid) tmp = max(tmp, qry((x << 1 | 1), mid + 1, r, L, R));
  return tmp;
}
void del(int x) { se.erase(se.find(mx[x])); }
void renew(int x) {
  se.insert(mx[x] = qry(1, 1, n + 1, fst[x], lst[x]) - dep[x] + 1);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  int tp = 0;
  for (int i = 1; i <= n; ++i) {
    for (; tp && a[i] > a[stk[tp]]; --tp) add(i, stk[tp]);
    stk[++tp] = i;
  }
  for (; tp; --tp) add(0, stk[tp]);
  dfs(0);
  for (int i = 1; i <= n; ++i) fa[i] = i;
  for (int i = 1, j = 1; i <= n - m + 1; ++i) {
    if (i - 1) {
      mdf(1, 1, n + 1, dfn[i - 1], 0);
      del(gfa(i - 1));
      renew(gfa(i - 1));
    }
    for (; j < i + m; ++j) {
      mdf(1, 1, n + 1, dfn[j], dep[j]);
      for (int k = head[j]; k; k = e[k].nxt) {
        del(e[k].v);
        fa[e[k].v] = j;
      }
      renew(j);
    }
    printf("%d ", *(--se.end()));
  }
  puts("");
  return 0;
}
