#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
int add(int a, int b) {
  if ((a += b) >= P) a -= P;
  return a < 0 ? a + P : a;
}
int mul(int a, int b) { return 1ll * a * b % P; }
int kpow(int a, int b) {
  int r = 1;
  for (; b; b >>= 1, a = mul(a, a)) {
    if (b & 1) r = mul(r, a);
  }
  return r;
}
const int N = 1e6 + 7;
int a[N], b[N], tr[N * 4], tip[N * 4], lft[N], rht[N], tim, n, k;
vector<int> g[N];
void dfs(int u) {
  lft[u] = ++tim;
  for (auto v : g[u]) dfs(v);
  rht[u] = tim;
}
void change(int l, int r, int now, int L, int R, int w) {
  if (L <= l && R >= r) {
    tip[now] += w;
    return;
  }
  int mid = (l + r) >> 1;
  if (L <= mid) change(l, mid, (now << 1), L, R, w);
  if (R > mid) change(mid + 1, r, ((now << 1) | 1), L, R, w);
  tr[now] = max(tr[(now << 1)] + tip[(now << 1)],
                tr[((now << 1) | 1)] + tip[((now << 1) | 1)]);
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> n >> k;
  for (int i = (1); i < (n + 1); i++) cin >> a[i];
  for (int i = (n + 1) - 1; i >= (1); i--) {
    for (b[i] = i + 1; b[i] <= n && a[b[i]] <= a[i]; b[i] = b[b[i]])
      ;
    g[b[i]].push_back(i);
  }
  dfs(n + 1);
  for (int i = (1); i < (k + 1); i++) change(1, tim, 1, lft[i], rht[i], 1);
  cout << tip[1] + tr[1] << " ";
  for (int i = (k + 1); i < (n + 1); i++) {
    change(1, tim, 1, lft[i], rht[i], 1);
    change(1, tim, 1, lft[i - k], lft[i - k], -(1ll << (30)));
    cout << tr[1] + tip[1] << " ";
  }
  return 0;
}
