#include <bits/stdc++.h>
using namespace std;
int n, k;
int arr[1000008];
int l[1000008];
int mx[1000008 << 2], lazy[1000008 << 2];
void pushup(int rt) { mx[rt] = max(mx[rt << 1], mx[rt << 1 | 1]); }
void build(int rt, int l, int r) {
  if (l > r) return;
  if (l == r) {
    mx[l] = arr[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  pushup(rt);
}
void pushdown(int rt) {
  mx[rt << 1] += lazy[rt];
  mx[rt << 1 | 1] += lazy[rt];
  lazy[rt << 1] += lazy[rt];
  lazy[rt << 1 | 1] += lazy[rt];
  lazy[rt] = 0;
}
void update(int rt, int l, int r, int L, int R, int C) {
  if (L <= l && r <= R) {
    lazy[rt] += C;
    mx[rt] += C;
    return;
  }
  pushdown(rt);
  int mid = (l + r) >> 1;
  if (L <= mid) update(rt << 1, l, mid, L, R, C);
  if (mid < R) update(rt << 1 | 1, mid + 1, r, L, R, C);
  pushup(rt);
}
int query(int rt, int l, int r, int L, int R) {
  if (L <= l && r <= R) return mx[rt];
  int mid = (l + r) >> 1;
  pushdown(rt);
  int ret = -1;
  if (L <= mid) ret = max(ret, query(rt << 1, l, mid, L, R));
  if (mid < R) ret = max(ret, query(rt << 1 | 1, mid + 1, r, L, R));
  return ret;
}
stack<int> sta;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &arr[i]);
  for (int i = n; i >= 1; --i) {
    while (!sta.empty() && arr[sta.top()] <= arr[i]) {
      l[sta.top()] = i + 1;
      sta.pop();
    }
    sta.push(i);
  }
  while (!sta.empty()) {
    l[sta.top()] = 1;
    sta.pop();
  }
  for (int i = 1; i <= n; ++i) {
    update(1, 1, n, l[i], i, 1);
    if (i >= k) {
      printf("%d ", query(1, 1, n, i - k + 1, i));
      update(1, 1, n, l[i - k + 1], i - k + 1, -1);
    }
  }
  return 0;
}
