#include <bits/stdc++.h>
using namespace std;
int i, j, l, cnt = 0;
int ar[1000050], tin[1000050], tout[1000050], ans[1000050], ta = 0;
int co[1000050] = {0};
vector<int> g[1000050];
void dfs(int x) {
  tin[x] = ++ta;
  for (auto it : g[x]) dfs(it);
  tout[x] = ta;
}
struct Segment {
  int l, r;
  int im, _im;
} seg[1000050 * 4];
void pp(int rt) { seg[rt].im = max(seg[2 * rt + 1].im, seg[2 * rt + 2].im); }
void pd(int rt) {
  if (seg[rt].im) {
    seg[2 * rt + 1]._im += seg[rt]._im;
    seg[2 * rt + 2]._im += seg[rt]._im;
    seg[2 * rt + 1].im += seg[rt]._im;
    seg[2 * rt + 2].im += seg[rt]._im;
    seg[rt]._im = 0;
  }
}
void bt(int rt, int l, int r) {
  seg[rt]._im = 0, seg[rt].l = l, seg[rt].r = r;
  if (l == r)
    seg[rt].im = 0;
  else {
    bt(2 * rt + 1, l, l + r >> 1);
    bt(2 * rt + 2, (l + r) / 2 + 1, r);
    pp(rt);
  }
}
void ud(int rt, int ul, int ur, int val) {
  int r = seg[rt].r, l = seg[rt].l;
  if (ur < l || r < ul) return;
  if (ul <= l && r <= ur) {
    seg[rt].im += val;
    seg[rt]._im += val;
    return;
  }
  pd(rt);
  ud(2 * rt + 1, ul, ur, val);
  ud(2 * rt + 2, ul, ur, val);
  pp(rt);
}
int qy(int rt, int ql, int qr) {
  int r = seg[rt].r, l = seg[rt].l;
  if (qr < l || r < ql) return 0;
  if (ql <= l && r <= qr) {
    return seg[rt].im;
  }
  pd(rt);
  return max(qy(2 * rt + 1, ql, qr), qy(2 * rt + 2, ql, qr));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (i = 1; i < n + 1; i++) cin >> ar[i];
  for (i = n + 1 - 1; i >= 1; i--) {
    for (l = i, j = i + 1; j <= n && !co[l];) {
      if (ar[j] > ar[l])
        co[l] = j, l = j;
      else
        j = co[j];
    }
    if (!co[l]) co[l] = n + 1;
  }
  for (i = 1; i < n + 1; i++) g[co[i]].push_back(i);
  dfs(n + 1);
  bt(0, 1, n + 1);
  for (i = 1; i < k; i++) ud(0, tin[i], tout[i], 1);
  for (i = k; i < n + 1; i++) {
    ud(0, tin[i], tout[i], 1);
    ans[cnt++] = seg[0].im;
    ud(0, tin[i - k + 1], tout[i - k + 1], -1);
  }
  for (i = 0; i < cnt; i++) cout << ans[i] << (n - i - 1 ? ' ' : '\n');
  return ~~(0 ^ 0 ^ 0);
}
