#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
struct Tree {
  int l, r, mx, laz;
} t[maxn << 2];
struct Node {
  int v, next;
} e[maxn << 1];
int head[maxn], dfn[maxn], siz[maxn], tot, num;
int sta[maxn], top;
long long a[maxn];
void Add(int x, int y) {
  e[++tot].v = y;
  e[tot].next = head[x];
  head[x] = tot;
}
void dfs(int x) {
  dfn[x] = ++num;
  siz[x] = 1;
  for (int i = head[x]; i; i = e[i].next) {
    int v = e[i].v;
    dfs(v);
    siz[x] += siz[v];
  }
}
void pushup(int rt) { t[rt].mx = max(t[rt << 1].mx, t[rt << 1 | 1].mx); }
void pushdown(int rt) {
  if (t[rt].laz) {
    t[rt << 1].laz += t[rt].laz;
    t[rt << 1 | 1].laz += t[rt].laz;
    t[rt << 1].mx += t[rt].laz;
    t[rt << 1 | 1].mx += t[rt].laz;
    t[rt].laz = 0;
  }
}
void build(int rt, int l, int r) {
  t[rt].l = l;
  t[rt].r = r;
  if (l == r) {
    return;
  }
  int mid = l + r >> 1;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  pushup(rt);
}
void modify(int rt, int l, int r, int val) {
  if (t[rt].l >= l && t[rt].r <= r) {
    t[rt].laz += val;
    t[rt].mx += val;
    return;
  }
  pushdown(rt);
  int mid = t[rt].l + t[rt].r >> 1;
  if (l <= mid) modify(rt << 1, l, r, val);
  if (r > mid) modify(rt << 1 | 1, l, r, val);
  pushup(rt);
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  a[n + 1] = 10000000000;
  for (int i = 1; i <= n + 1; ++i) {
    while (top && a[sta[top]] < a[i]) {
      Add(i, sta[top]);
      top--;
    }
    sta[++top] = i;
  }
  dfs(n + 1);
  build(1, 1, n + 1);
  for (int i = 1; i <= k; ++i) {
    modify(1, dfn[i], dfn[i] + siz[i] - 1, 1);
  }
  printf("%d ", t[1].mx);
  for (int i = 2; i + k - 1 <= n; ++i) {
    modify(1, dfn[i - 1], dfn[i - 1] + siz[i - 1] - 1, -1);
    modify(1, dfn[i + k - 1], dfn[i + k - 1] + siz[i + k - 1] - 1, 1);
    printf("%d ", t[1].mx);
  }
  return 0;
}
