#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e6 + 5;
const int OFF = 1 << 20;
int timer;
int arr[MXN];
int sol[MXN];
int tin[MXN];
int tout[MXN];
int tree[2 * OFF];
int prop[2 * OFF];
vector<int> adj[MXN];
void update(int l, int r, int dx, int lo = 0, int hi = OFF, int x = 0) {
  if (l <= lo && hi <= r) {
    tree[x] += dx;
    prop[x] += dx;
    return;
  }
  int mid = (lo + hi) / 2;
  if (l < mid) update(l, r, dx, lo, mid, 2 * x + 1);
  if (mid < r) update(l, r, dx, mid, hi, 2 * x + 2);
  tree[x] = max(tree[2 * x + 1], tree[2 * x + 2]) + prop[x];
}
void dfs(int x) {
  tin[x] = timer++;
  for (int y : adj[x]) {
    dfs(y);
  }
  tout[x] = timer;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  stack<int> stk;
  for (int i = n - 1; i >= 0; --i) {
    while (stk.size() && arr[stk.top()] <= arr[i]) {
      stk.pop();
    }
    if (stk.size()) {
      adj[stk.top()].push_back(i);
    }
    stk.push(i);
  }
  for (int i = n - 1; i >= 0; --i) {
    if (!tin[i]) {
      dfs(i);
    }
  }
  update(0, OFF, -MXN);
  for (int i = n - 1; i >= 0; --i) {
    if (n - i > k) {
      int j = i + k;
      update(tin[j], tout[j], -1);
      update(tin[j], tin[j] + 1, -MXN);
    }
    update(tin[i], tout[i], 1);
    update(tin[i], tin[i] + 1, MXN);
    sol[i] = tree[0];
  }
  for (int i = 0; i <= n - k; ++i) {
    cout << sol[i] << ' ';
  }
}
