#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
const int M = N << 1;
int n, K, a[N];
int st[N], L;
int f[N];
int cnt, head[N], Next[M], v[M];
int pre[N], dfn[N], clo = -1;
int t[N << 2], lazy[N << 2];
void read(int &x) {
  char ch = getchar();
  x = 0;
  for (; ch < '0' || ch > '9'; ch = getchar())
    ;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 3) + (x << 1) + ch - '0';
}
void add(int x, int y) {
  Next[++cnt] = head[x];
  head[x] = cnt;
  v[cnt] = y;
}
void dfs(int x, int fa) {
  pre[x] = ++clo;
  for (int i = head[x]; i; i = Next[i])
    if (v[i] != fa) dfs(v[i], x);
  dfn[x] = clo;
}
void push(int node) {
  int &v = lazy[node];
  lazy[(node << 1)] += v;
  t[(node << 1)] += v;
  lazy[(node << 1 | 1)] += v;
  t[(node << 1 | 1)] += v;
  v = 0;
}
void ADD(int node, int L, int r, int x, int y, int v) {
  if (L >= x && r <= y) {
    t[node] += v;
    lazy[node] += v;
    return;
  }
  int mid = (L + r) >> 1;
  push(node);
  if (x <= mid) ADD((node << 1), L, mid, x, y, v);
  if (y > mid) ADD((node << 1 | 1), mid + 1, r, x, y, v);
  t[node] = max(t[(node << 1)], t[(node << 1 | 1)]);
}
int QRY(int node, int L, int r, int x, int y) { return t[1]; }
int main() {
  read(n);
  read(K);
  for (int i = (1); i <= (n); i++) read(a[i]);
  a[0] = 1e9;
  for (int i = (n); i >= (1); i--) {
    while (a[st[L]] <= a[i]) L--;
    f[i] = st[L];
    st[++L] = i;
  }
  for (int i = (1); i <= (n); i++) add(f[i], i);
  dfs(0, 0);
  for (int i = (1); i <= (K); i++) ADD(1, 1, n, pre[i], dfn[i], 1);
  printf("%d ", QRY(1, 1, n, 1, n));
  for (int i = (K + 1); i <= (n); i++) {
    ADD(1, 1, n, pre[i - K], dfn[i - K], -1);
    ADD(1, 1, n, pre[i], dfn[i], 1);
    printf("%d ", QRY(1, 1, n, 1, n));
  }
  printf("\n");
  return 0;
}
