#include <bits/stdc++.h>
using namespace std;
int a[1005000], now = 1, lazy[5000500], size[1005000], xu[1005000], cn, n, m,
                maxn[5000050], head[1000500], nex[1000500], to[1005000], cnt,
                p[1005000], zhan[1005000], o;
void add(int x, int y) {
  nex[++cnt] = head[x];
  head[x] = cnt;
  to[cnt] = y;
}
void push(int x) {
  lazy[x * 2] += lazy[x];
  lazy[x * 2 + 1] += lazy[x];
  maxn[x * 2] += lazy[x];
  maxn[x * 2 + 1] += lazy[x];
  lazy[x] = 0;
}
void addd(int l, int r, int rt, int ql, int qr, int w) {
  if (ql <= l && qr >= r) {
    maxn[rt] += w;
    lazy[rt] += w;
    return;
  }
  int mid = (l + r) / 2;
  if (lazy[rt]) push(rt);
  if (ql <= mid) addd(l, mid, rt * 2, ql, qr, w);
  if (qr > mid) addd(mid + 1, r, rt * 2 + 1, ql, qr, w);
  maxn[rt] = max(maxn[rt * 2], maxn[rt * 2 + 1]);
}
void dfs(int x) {
  xu[x] = ++cn;
  size[x] = 1;
  for (int i = head[x]; i; i = nex[i]) {
    dfs(to[i]);
    size[x] += size[to[i]];
  }
}
int get(int l, int r, int rt, int q) {
  if (l == r) return maxn[rt];
  int mid = (l + r) / 2;
  if (q <= mid) return get(l, mid, rt * 2, q);
  return get(mid + 1, r, rt * 2 + 1, q);
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    while (o && zhan[o] < a[i]) {
      add(i, p[o]);
      o--;
    }
    zhan[++o] = a[i];
    p[o] = i;
  }
  for (int i = 1; i <= o; i++) add(n + 1, p[i]);
  dfs(n + 1);
  for (int i = 1; i <= n; i++) {
    addd(1, n + 1, 1, xu[i], xu[i] + size[i] - 1, 1);
    while (i - now >= m) addd(1, n + 1, 1, xu[now], xu[now], -1000000), now++;
    if (i >= m) printf("%d ", maxn[1]);
  }
}
